generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: HELP!!!!! *URGENT*

Previous Thread :: Next Thread 
ZeveI is not online. 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 is not online. sbk28
Joined: 15 Nov 2008
Total Posts: 2528
15 Nov 2014 03:37 PM
script.Sound:Pause() ?
Report Abuse
ZeveI is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image