I dislike Vector3 and this is why. No idea what I'm doing.
while true do
wait()
script.Parent.Engine.BodyThrust.Force = script.Parent.Speed.Value
end
I dislike Vector3 and this is why. No idea what I'm doing.
while true do
wait()
script.Parent.Engine.BodyThrust.Force = script.Parent.Speed.Value
end
Is 'Speed' a Vector3 value? If not, you've found your issue. 'Speed' needs to be a Vector3 value. If it is, and not working, try one of two solutions.
--1, set 'Speed' as a Vector3 Value and fill in values. If you don't know how to fill in Vector3 Values, skip this and move on to the second one.
while true do
wait()
script.Parent.Engine.BodyThrust.Force = script.Parent.Speed.Value
end
--2, I've made the Speed Vector3 Value for you. You can assign values for x,y, and z. For example (45,0,0) or (0,0,45) would be fine for a car. These in velocities would move flawlessly along a flat baseplate. The middle value, 'Y', is perfect for rockets! It will travel indefinitely in the Y direction (Up if positive value and down if negative value!)
local Speed = Instance.new("Vector3Value")
Speed.Parent = script.Parent
Speed.Name = "Speed"
Speed.Value = Vector3.new(40,0,0) --[[I'm assuming you're building a car when filling out the X value for you. X is the value in studs per second the object will move in the X direction, Y being sp/s in the Y direction and Z being the speed of the object moving in the Z direction.]]--
script.Parent.Engine.BodyThrust.Force = script.Parent.Speed.Value
Hope this helped, 2Loos.
I see what your question is, I doubt you can go from a NumberValue/IntValue to a Vector3.
As far as I know you can set x,y,z to number values. For example, if you have 34 as a number value, and defined by variable 'e' (Made up here!,) you can use Vector3.new(e,0,0) Now I'm not sure this will work, but you can try it. Best regards, 2Loos.
Thanks for the fact you can put a variable in a Vector3. Really helped my many problems!
Hey, no issue, Vector3 is really important to things like size, momentum, movement, etc. I'm glad you learned it, it's essential to scripting.
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
script.Parent.Speed.Value is a number I guess. Use a Vector3(x,y,z) Value instead. It's not that hard to understand, pretend X is the left-right direction, Y the up and down direction, and Z the front and back direction. So Vector3.new(0,5,0) will have a upward force of 5.