I want to be able to have a script that will call a function when the player on the vehicle seat moves forward left right and back etc...but i don't know how make a script detect a vehicle seats direction the player wants it to go how can i do this? sorry if question isnt clear
The easiest. VeichleSeat
instance owns two properies, Steer
and Throttle
.
Steer
is related to the side movement. 1 means right, 0 means no direction and -1 means left
Throttle
is related to the "engine" movement. 1 means forwards, 0 means no engine work and -1 means reverse work (backwards)
So, you may use Changed()
event to determine whatever of the properties is being changed.
game.Workspace.Car.VeichleSeat.Changed:connect(function(p) if p == "Throttle" then local val = game.Workspace.Car.VeichleSeat[p] --Do stuff elseif if p == "Throttle" then local val = game.Workspace.Car.VeichleSeat[p] --Do stuff else return end -- does nothing end)