Mryeetmemes

Some script I found in the new roblox studio template

May 15th, 2023 (edited)
896
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.72 KB | None | 0 0
  1. local Seat = script.Parent.Seat
  2. local ProximityPrompt = script.Parent.ProximityPrompt
  3.  
  4. ProximityPrompt.Triggered:connect(function(plr) -- upon clicking
  5.     if Seat.Occupant then return end -- make sure seat isn't already taken
  6.  
  7.     local char = plr.Character
  8.     if not char then return end -- make sure the player has a character
  9.  
  10.     local humanoid = char:FindFirstChildOfClass("Humanoid")
  11.     if not humanoid then return end -- make sure the char has a humanoid
  12.    
  13.     Seat:Sit(humanoid) -- forces the humanoid to sit on the seat
  14. end)
  15.  
  16. Seat:GetPropertyChangedSignal("Occupant"):Connect(function()
  17.     local humanoid = Seat.Occupant
  18.     if humanoid then
  19.         ProximityPrompt.Enabled = false
  20.     else
  21.         ProximityPrompt.Enabled = true
  22.     end
  23. end)
Advertisement
Add Comment
Please, Sign In to add comment