How can i make this ball follow the player but not rise upwards?

  1. What do you want to achieve? Keep it simple and clear!

Basically. I got a ball that moves towards you with velocity. My only problem is that whenever youre on a higer level than the ball. Itll start to rise towards you which i dont want. I want it to move towards the player but not start rising upwards like a rocket lol whenever youre on a high place.

Example of what i mean with “Rise towards the player”

How would i fix this? im not the best with math. So i have no idea what formula youd use to fix this??

this is the current code the ball uses to move

self.Move = game["Run Service"].Stepped:Connect(function()
			local Plr = GetNearestPlr(Meta.Ball.PrimaryPart.Position)

			if Plr then
				Meta.Ball.PrimaryPart.AssemblyLinearVelocity = (Plr.Parent.PrimaryPart.Position-Meta.Ball.PrimaryPart.Position).Unit*20 
			end
		end)
self.Move = game["Run Service"].Stepped:Connect(function()
	local Plr = GetNearestPlr(Meta.Ball.PrimaryPart.Position)

	if Plr then
		Meta.Ball.PrimaryPart.AssemblyLinearVelocity = (Vector3.new(Plr.Parent.PrimaryPart.Position.X, Meta.Ball.PrimaryPart.Position.Y, Plr.Parent.PrimaryPart.Position.Z)-Meta.Ball.PrimaryPart.Position).Unit*20 
	end
end)
2 Likes
local PlayerPosition = Plr.Parent.PrimaryPart.Position
local MovePosition = Vector3.new(PlayerPosition.X,0,PlayerPosition.Z)
Meta.Ball.PrimaryPart.AssemblyLinearVelocity = (MovePosition-Meta.Ball.PrimaryPart.Position).Unit*20 

Try this

1 Like

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