-- Create and load the animations

loadAnimation(animationController, Animations.SuperheroIdle):Play()
waveAnimationTrack = loadAnimation(animationController, Animations.Wave)
waveAnimationTrack.Looped = false


RunService.Stepped:Connect(function()
	local distance = makeNPCLookAt(character.PrimaryPart.Position)
	if distance and distance < WAVE_THRESHOLD then
		if tick() - lastWavedAt > WAVE_DEBOUNCE_TIME and not characterIsNear then
			waveAnimationTrack:Play(.5)
			lastWavedAt = tick()
		end
		characterIsNear = true
	else
		characterIsNear = false
	end
end)
