How to make a ball move smoothier

Hello. basicly, i did a ball that follows a Player and vanish when touch them, it’s working, but the moviment isn’t so smooth, any advice to make it more smooth?

Here’s the code that make the movement:

			local follow = true
			local Speed = 15
			while follow == true do
				local distance = (GreenBall.Position - Player.Character.HumanoidRootPart.Position).Magnitude
				if distance < 3 then
					follow = false
					GreenBall:Destroy()
				else
					task.wait(0.1)
					Speed += 1
					GreenBall.CFrame = CFrame.new(GreenBall.Position, Player.Character.HumanoidRootPart.Position)
					LinearVelocity.VectorVelocity = GreenBall.CFrame.LookVector * Speed
				end
			end
1 Like

Maybe set the updated speed to 0.1 and decrease the time between each update to task.wait(0.01)?

I’m also thinking maybe you could also tween it to the players HumanoidRootPart?

2 Likes

Try lowering the wait to this:

task.wait()

You can also look into lerping/tweening, but I would recommend lerps in a loop.

1 Like

I swear, i don’t know how i didn’t though of putting 0.01 instead of 0.1
Well, it’s going to the player very smooth now, thank you :smiley:

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.