Advertisement
Guest User

Script

a guest
May 10th, 2018
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.03 KB | None | 0 0
  1. local UserInputService = game:GetService("UserInputService")
  2. local Player = game.Players.LocalPlayer
  3.  
  4. local Seat = workspace:WaitForChild('Seat')                             -- Where the seat is
  5. Active = false
  6.  
  7. function onInputBegan(input,gameProcessed)
  8.     if input.KeyCode == Enum.KeyCode.C then                             -- Which button
  9.         if Seat.Occupant and Seat.Occupant.Parent.Name == Player.Name
  10. then
  11.             Active = true
  12.         end
  13.     end
  14. end
  15.  
  16. function onInputEnded(input,gameProcessed)
  17.     if input.KeyCode == Enum.KeyCode.C then                             -- Which button
  18.         if Seat.Occupant and Seat.Occupant.Parent.Name == Player.Name
  19. then
  20.             Active = false
  21.         end
  22.     end
  23. end
  24.  
  25. Seat.Changed:Connect(function(Prop)
  26.     if Prop == 'Occupant' then
  27.         local Occupant = Seat.Occupant
  28.         if Occupant then
  29.             -- Nothing
  30.         else
  31.             Active = false --> Player left the seat
  32.         end
  33.     end
  34. end)
  35.  
  36. UserInputService.InputBegan:connect(onInputBegan)
  37. UserInputService.InputBegan:connect(onInputEnded)
  38.  
  39. while wait() do
  40.     if Active == true then
  41.         game.SoundService.Sound.Playing = true                          -- Code
  42.     end
  43. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement