I am making an exercising bike and I made this local script inside the seat. It's supposed to detect when someone touches the seat. After that, it will launch the OnTouched function. The OnTouched function prints function activated after 3 seconds to show that the function has been activated. After that is printed, it will check if the player is sitting, and if so, it will print to show that it works and then gives them money. At the moment the output says nothing and also doesn't print anything.
local Player = game.Players.LocalPlayer --Get the player's character here
local money = game.Players.LocalPlayer.leaderstats.SeerBucks
local function OnTouched(player)
wait(3)
print("function activated")
if Player.Humanoid.Sit == true then
print("If Worked")
money.Value = money.Value + 100
end
end
script.Parent.Touched:Connect(OnTouched)

3 comments
So do you want it to call script when seat is touched or when someone sits on it?
Seats have the Occupant property so maybe you can listen for changes on that instead of using Touched..
Sorry, should have specified. I want it to trigger the script when they are sitting