local character = script.Parent local humanoid = character:WaitForChild("Humanoid") local player = script.Parent.Name local PlayPlayer = game.Players:FindFirstChild(player) local Sitting = false humanoid.Seated:Connect(function(isSeated, seat) if isSeated then if seat == workspace.INSPARE.DriveSeat then Sitting = true while true do wait(1) if Sitting == true then PlayPlayer.leaderstats.Cash.Value = PlayPlayer.leaderstats.Cash.Value + 1 end end end else print("The Player Stopped Sitting") Sitting = false end end)
Hello, I found this code on the devfourms but I don't know how to how to make it define all of the vehicle seats in the workspace. I want to change this line of code:
if seat == workspace.INSPARE.DriveSeat then
Everytime i've tried to fix it it just gives an error. Please help!
The answer to this is pretty simple. ^w^
Code:
local character = script.Parent local humanoid = character:WaitForChild("Humanoid") local player = script.Parent.Name local PlayPlayer = game.Players:FindFirstChild(player) local Sitting = false humanoid.Seated:Connect(function(isSeated, seat) if isSeated then Sitting = true while true do wait(1) if Sitting == true then PlayPlayer.leaderstats.Cash.Value = PlayPlayer.leaderstats.Cash.Value + 1 end end else print("The Player Stopped Sitting") Sitting = false end end)
All we had to do was remove the "if seat ==" line, and now it triggers for every seat. Hope this helped. ^w^