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?
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.