Floating Orb & Following

I’m trying to make a floating orb that kind of moves around at intervals but a little problem is that it decides to float off into space randomly.

function Light:Float(LightPart)
	Light.TweenService:Create(LightPart, TweenInfo.new(1.2), {Position = LightPart.Position + Vector3.new(0,3,0)}):Play()
	wait(1.2)
	Light.TweenService:Create(LightPart, TweenInfo.new(1.2), {Position = LightPart.Position + Vector3.new(0,-3,0)}):Play()
end

Light.RunService.Stepped:Connect(function()
		if Light.Data.IsAllowed == true then 
			if Light.Data.TimesMoveRan == 3 or Light.Data.TimesMoveRan == 6 or Light.Data.TimesMoveRan == 9 then
				Light.Data.IsAllowed = false
				Light:MovePoints(LightPart)
				wait(5)
				Light.Data.TimesMoveRan = Light.Data.TimesMoveRan + 1
				Light.Data.IsAllowed = true
			else
				Light.Data.IsAllowed = false
				Light:Float(LightPart)
				wait(2.5)
				Light.Data.TimesMoveRan = Light.Data.TimesMoveRan + 1
				Light.Data.IsAllowed = true
			end
		end
	end)

After a little bit of movement, just walking & jumping it decides to float off.
image

vs normal

image

Don’t yield (call wait) inside a Stepped event. Your event handler will still run every frame. I think you just want a normal loop:

while true do
	if Light.Data.IsAllowed == true then 
		if Light.Data.TimesMoveRan == 3 or Light.Data.TimesMoveRan == 6 or Light.Data.TimesMoveRan == 9 then
			Light.Data.IsAllowed = false
			Light:MovePoints(LightPart)
			wait(5)
			Light.Data.TimesMoveRan = Light.Data.TimesMoveRan + 1
			Light.Data.IsAllowed = true
		else
			Light.Data.IsAllowed = false
			Light:Float(LightPart)
			wait(2.5)
			Light.Data.TimesMoveRan = Light.Data.TimesMoveRan + 1
			Light.Data.IsAllowed = true
		end
	end
end