Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why wont the body velocity change?

When I click a part I want it to move the player up, I already added a body velocity into the humanoid root part. It just tells me this in the output every time I click the part.

Infinite yield possible on 'Workspace.Paczki_TCBC.HumanoidRootPart:WaitForChild("BodyVelocity")'

(Paczki_TCBC is my username)

Here is my script:

local event = game.ReplicatedStorage.Events.RopeEvent
local click = script.Parent

click.MouseClick:Connect(function(plr)
	wait()
	local nameofplr = plr.name
	local person = game.Workspace:FindFirstChild(nameofplr)
	print("clicked")
	local bodyVel = person.HumanoidRootPart:WaitForChild("BodyVelocity")
	bodyVel.MaxForce = Vector3.new(0,40000,0)
	
end)

2 answers

Make sure that your body velocity is created server-side and not locally. If the body velocity is created with a local script it is local to the client and the server wont see it.

"Infinite yield possible" happens when WaitForChild() has "waited" for more than 5 seconds and still hasn't found anything. odds are it's not detecting the bodyvelocity, which could be any number of reasons such as it's not getting added properly, or it's named something else.

This discussion is preserved as it was. New answers, comments, and votes are closed.