The error occurred in this script;
while true do if script.Parent.Parent.Parent.Parent.Speed.Start.Value == true then script.Parent.velocity.X = script.Parent.Parent.Parent.Parent.Speed.Speed.Value else script.Parent.velocity.X = 0 end wait() end
the second to last Speed in
script.Parent.velocity.X = script.Parent.Parent.Parent.Parent.Speed.Speed.Value
is the Intvalue, and the one before that is a model called Speed.
Also, Start is a BoolValue in the model Speed.
But why doesn't this work?
Your problem is that you're trying to individually manipulate the X axis
- You can't do this. The Individual X, Y, and Z axis scales are read-only. Meaning that you can only take information from them, not assign information to them.
So to fix, you need to assign the velocity property with a Vector3 on all axises at the same time.
Also, I suggest you use the Changed event to set the property, rather than a while
loop, it's much more efficient.
local val = script.Parent.Parent.Parent.Parent.Speed val.Speed.Changed:connect(function(change) if val.Start.Value == true then script.Parent.velocity = Vector3.new(change,0,0) end end)
You can't directly set those values. You have to set the full thing for example you can't do:
part.Position.X = 6
you would have to do
part.Position = Vector3.new(6, part.Position.Y, part.Position.Z)
I'm not sure exactly why this is but I believe has to do with them being read only or something similar.
I hope you can apply this to your code. If you need help doing so, ask.