Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Seat = script.Parent.Seat
- local ProximityPrompt = script.Parent.ProximityPrompt
- ProximityPrompt.Triggered:connect(function(plr) -- upon clicking
- if Seat.Occupant then return end -- make sure seat isn't already taken
- local char = plr.Character
- if not char then return end -- make sure the player has a character
- local humanoid = char:FindFirstChildOfClass("Humanoid")
- if not humanoid then return end -- make sure the char has a humanoid
- Seat:Sit(humanoid) -- forces the humanoid to sit on the seat
- end)
- Seat:GetPropertyChangedSignal("Occupant"):Connect(function()
- local humanoid = Seat.Occupant
- if humanoid then
- ProximityPrompt.Enabled = false
- else
- ProximityPrompt.Enabled = true
- end
- end)
Add Comment
Please, Sign In to add comment