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

How do you find when a velocity changes?

I am having trouble finding when a value changes, namely the magnitude of the velocity of a head. Here's what I have so far:

local Head = script.Parent:FindFirstChild("Head")
 
Head.Changed:connect(function(property)
	warn(property)
	if property == "Velocity" then
		print("Velocity Change")
		if Head.Velocity.Magnitude > 1 then
			print(Head.Velocity.Magnitude)
			wait(0.1)
		end
	end
end)

(Its in StarterCharacterScripts)

What am I doing wrong?

1 answer

✓ Accepted answer

You need to define the Velocity, so you will need something like this

local head = script.Parent:WaitForChild('Head').BodyVelocity.Value --I recommend using WaitForChild instead of FindFirstChild to prevent issues on the server. And I also don't know how the Velocity is named in your case.

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