Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local UserInputService = game:GetService("UserInputService")
- local Player = game.Players.LocalPlayer
- local Seat = workspace:WaitForChild('Seat') -- Where the seat is
- Active = false
- function onInputBegan(input,gameProcessed)
- if input.KeyCode == Enum.KeyCode.C then -- Which button
- if Seat.Occupant and Seat.Occupant.Parent.Name == Player.Name
- then
- Active = true
- end
- end
- end
- function onInputEnded(input,gameProcessed)
- if input.KeyCode == Enum.KeyCode.C then -- Which button
- if Seat.Occupant and Seat.Occupant.Parent.Name == Player.Name
- then
- Active = false
- end
- end
- end
- Seat.Changed:Connect(function(Prop)
- if Prop == 'Occupant' then
- local Occupant = Seat.Occupant
- if Occupant then
- -- Nothing
- else
- Active = false --> Player left the seat
- end
- end
- end)
- UserInputService.InputBegan:connect(onInputBegan)
- UserInputService.InputBegan:connect(onInputEnded)
- while wait() do
- if Active == true then
- game.SoundService.Sound.Playing = true -- Code
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement