Changing body velocity properties from values

How do I go about changing the X,Y,Z properties from a number or int value(s)

I have this currently which does not work. I have tried doing value changed functions, reordering of code, etc.

while true do
	local X = script.Parent.XVal.Value
	local Y = script.Parent.YVal.Value
	local Z = script.Parent.ZVal.Value
	script.Parent.BodyVelocity.Velocity = Vector3.new(X,Y,Z)
	wait()
end

Is this a server script, and are you changing the values manually or through a script? If you change it manually through the properties tab make sure you are changing them from the server, not the client.

I’m an idiot lol fixed it was a local script