onLeaveDriveState

Constructor:

onLeaveDriveState()

Description

Triggered when the avatar exits driving state.

Examples

Create a vehicle seat. When the avatar leaves the vehicle seat, trigger the method of creating a part.

local vseat = RWObject.Create("VehicleSeat") -- create a vehicle seat
vseat.Position = Vector3.New(3,1,3)
vseat.Parent = WorkSpace
vseat.onLeaveDriveState:Connect(function() -- execute the method of creating a part when the player enters driving state
   local addpart = RWObject.Create("Part")
   addpart.Color = Vector3.New(255,0,0)
   addpart.Position = Vector3.New(1,1,2)
   addpart.Anchored = true
   addpart.Parent = WorkSpace
end)