Velocity not working

Hello! I coded this system where it should set the velocity of a part to the nearest player. For some reason its not working and it just goes down. Can someone help? :pray:

		local Players = game:GetService("Players")

		local part = clone

		local maxDistance = 100

			wait(1)
			local nearestPlayer, nearestDistance
			for _, player in pairs(game.Teams.Playing:GetPlayers()) do
				local character = player.Character
				local distance = player:DistanceFromCharacter(part.Position)
				if not character or 
					distance > maxDistance or
					(nearestDistance and distance >= nearestDistance)
				then
					continue
				end
				nearestDistance = distance
				nearestPlayer = player
			end
		print("The nearest player is ", nearestPlayer)
		clone.CFrame = CFrame.lookAt(clone.Position, nearestPlayer.Character:GetPivot().Position)
		clone.Velocity = nearestPlayer.Character.HumanoidRootPart.CFrame.LookVector*script.Parent.Speed.Value
1 Like

Try using ApplyImpulse instead, I don’t know if its your problem but you should try:

clone:ApplyImpulse(nearestPlayer.Character.HumanoidRootPart.CFrame.LookVector*script.Parent.Speed.Value)

Make sure you play around with your speed value as well.

If you are trying to move the part to the player, then you should try body velocity or something like moveto, and make that go to the player I guess.

I tried that but it just does the same thing. The part goes down.