how to get the speed of a seat into a gui i have this
script.Parent.Text = game.Workspace.VehicleSeat.Speed
how to get the speed of a seat into a gui i have this
script.Parent.Text = game.Workspace.VehicleSeat.Speed
#####Issues
Speed is not a property of VehicleSeat objects. What you should be referencing is Velocity.
Consider when the property changes, rather than just updating the gui once. You can do this with the Changed event.
######Note :: GUI code should always be in a LocalScript. There is no reason for the server to handle the client's UI.
#####Code
--Use WaitForChild since client code may load faster than the server
local vehicle = workspace:WaitForChild("VehicleSeat")
--Use `Velocity`
function match()
--Index the magnitude member to get the length of the vector,
--rather than the axis values
script.Parent.Text = vehicle.Velocity.magnitude
end
match() --Match initially
vehicle.Changed:Connect(match) --Match upon changing
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
GOULSTEM IS BACK !
;D