ZeveI
|
  |
| Joined: 29 Sep 2012 |
| Total Posts: 8003 |
|
|
| 15 Nov 2014 03:32 PM |
How do i get this audio to stop playing once the player jumps off of the seat???
seat.ChildAdded:connect(function(newChild) if newChild:IsA("Weld") then script.Sound:Play() local player = GetPlayerFromWeld(newChild) if player then script[ToolName].Seat.Value = script.Parent script[ToolName]:Clone().Parent = player.Backpack end end
"the universe came from a magic explosion" - athiests |
|
|
| Report Abuse |
|
|
sbk28
|
  |
| Joined: 15 Nov 2008 |
| Total Posts: 2528 |
|
| |
|
ZeveI
|
  |
| Joined: 29 Sep 2012 |
| Total Posts: 8003 |
|
|
| 15 Nov 2014 03:38 PM |
i don't know where to put that line at though.
"the universe came from a magic explosion" - athiests |
|
|
| Report Abuse |
|
|
sbk28
|
  |
| Joined: 15 Nov 2008 |
| Total Posts: 2528 |
|
|
| 15 Nov 2014 03:39 PM |
dont really do much with seats
but seeing as you used childadded to detect a weld when someone sat can you not use childremoving to detect a weld being deleted when they stand up? |
|
|
| Report Abuse |
|
|
ZeveI
|
  |
| Joined: 29 Sep 2012 |
| Total Posts: 8003 |
|
|
| 15 Nov 2014 03:41 PM |
I'm kinda nooby at scripting, i didn't practice on seats.
"the universe came from a magic explosion" - athiests |
|
|
| Report Abuse |
|
|
DevVince
|
  |
| Joined: 08 Nov 2008 |
| Total Posts: 9245 |
|
|
| 15 Nov 2014 03:42 PM |
--Did not test this but might work.
audio = script.Sound
seat.ChildAdded:connect(function(nc) if nc:IsA'Weld' then audio:Play() local p = GetPlayerFromWeld(newChild) if p and p.Character then script[ToolName].Seat.Value = script.Parent script[ToolName]:Clone().Parent = player.Backpack end local hum = p.Character:WaitForChild'Humanoid' local stop = hum.Changed:connect(function(c) if c == hum.Jump then--Donno if I did this right or not. wait()--Incase player sits and jumps instantly it won't bug. audio:Stop() stop:Disconnect() end end) end end) |
|
|
| Report Abuse |
|
|
sbk28
|
  |
| Joined: 15 Nov 2008 |
| Total Posts: 2528 |
|
|
| 15 Nov 2014 03:42 PM |
as i said i dont really use seats either
but can you not set up an almost identical function with .ChildRemoving:connect
instead
with script.Sound:Pause() |
|
|
| Report Abuse |
|
|