Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How can i dectect Vehicle Seat movement to call a function???

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

2 comments

0

Ok i see i got a clearer idea now...i use the throttle and steer properties and use a script to detect them, which then i can call a function thanks DevSean

1 answer

✓ Accepted answer

The easiest. VeichleSeatinstance 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)

This discussion is preserved as it was. New answers, comments, and votes are closed.