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: How do I make this work?

Previous Thread :: Next Thread 
Pexur is not online. Pexur
Joined: 23 Jun 2008
Total Posts: 12779
09 Apr 2014 11:14 AM
I'm trying to make it so when you step on a brick it makes sound1 stop and sound2 play. This is all i got so far

while true do
script.sound1:Stop()
wait(10)
script.sound2:Play()

How would I make this working?
Report Abuse
hugthefatman1 is not online. hugthefatman1
Joined: 06 Sep 2012
Total Posts: 1333
09 Apr 2014 11:17 AM
use OnTouch... and id decrease the wait a liitle
Report Abuse
Pexur is not online. Pexur
Joined: 23 Jun 2008
Total Posts: 12779
09 Apr 2014 11:21 AM
workspace.PATH.TO.BRICK.Touched:connect(function()
script.sound1.SoundId = "whatever"
end)

while true do
script.sound1:Stop()
wait(3)
script.sound1:Play()

end

Would this work?
Report Abuse
Introducted is not online. Introducted
Joined: 09 Feb 2013
Total Posts: 836
09 Apr 2014 11:25 AM



function onTouched(hit)
-- do stuff
script.Parent.Touched:connect(onTouched)
Report Abuse
Introducted is not online. Introducted
Joined: 09 Feb 2013
Total Posts: 836
09 Apr 2014 11:25 AM
^^^^^^
put that script in a brick
Report Abuse
Spongocardo is not online. Spongocardo
Joined: 06 Sep 2008
Total Posts: 2843
09 Apr 2014 11:27 AM
game.Workspace.PATH.TO.BRICK.Touched:connect(function() --Guesssing you know the drill here.
script.sound1.SoundId = "whatever" --Guesssing you know the drill here also.
end)

while true do
script.sound1:Stop()
wait(3)
script.sound1:Play()
wait(3) --Change 3 to whatever if needed.
end


When life gives you lemons... BURN HIS HOUSE DOWN! >:D
Report Abuse
Introducted is not online. Introducted
Joined: 09 Feb 2013
Total Posts: 836
09 Apr 2014 11:28 AM
ahaaaaaaaaah
k, watchout or ima shoot you
Report Abuse
Pexur is not online. Pexur
Joined: 23 Jun 2008
Total Posts: 12779
09 Apr 2014 11:33 AM
@spongocardo

I did this with your script

game.Workspace.PATH.TO.BRICK.Touched:connect(function() --Guesssing you know the drill here.
script.sound1.SoundId = "http://www.roblox.com/asset/?id=130987585" --Guesssing you know the drill here also.
end)

while true do
script.sound1:Stop()
wait(3)
script.sound1:Play()
wait(3) --Change 3 to whatever if needed.
end

Not sure if I did it right because it's not working
Report Abuse
Spongocardo is not online. Spongocardo
Joined: 06 Sep 2008
Total Posts: 2843
09 Apr 2014 11:36 AM
PATH.TO.BRICK needs to be changed to the path of the brick you want. If you want it to play the sound as well when you touch it, use this:

game.Workspace.PATH.TO.BRICK.Touched:connect(function() --PATH.TO.BRICK needs to change to your path to the brick.
script.sound1.SoundId = "http://www.roblox.com/asset/?id=130987585" --Guesssing you know the drill here also.

while true do
script.sound1:Stop()
wait(3)
script.sound1:Play()
wait(3) --Change 3 to whatever if needed.
end
end)

When life gives you lemons... BURN HIS HOUSE DOWN! >:D
Report Abuse
Frostehz is not online. Frostehz
Joined: 03 Apr 2014
Total Posts: 628
09 Apr 2014 11:37 AM
lkkk
Report Abuse
Pexur is not online. Pexur
Joined: 23 Jun 2008
Total Posts: 12779
09 Apr 2014 11:58 AM
game.Workspace.Brick.Touched:connect(function() --Guesssing you know the drill here.
script.sound1.SoundId = "http://www.roblox.com/asset/?id=146824166" --Guesssing you know the drill here also.
end)

while true do
script.sound1:Stop()
wait(3)
sound2:Play()
wait(3)
end

so this would work if i have a part named brick just in workspace and sound2 isn't in a script?

Just to make sure the soundid part you're supposed to put the sound1 id right?
Report Abuse
powertool is not online. powertool
Joined: 01 Feb 2008
Total Posts: 3771
09 Apr 2014 12:12 PM
That'd not actually audibly play your sound. You're playing it then stopping it immediately.
There's also no need for a while true do loop.

local db = false
local time = tonumber(whatever)
game.Workspace.path.to.part.Touched:connect(function()
if db == false then db = true
script.sound1:Stop()
wait(time)
script.sound2:Play()
else
return
end
db = false
end)

--Shira
Report Abuse
Essentially is not online. Essentially
Joined: 06 Jun 2012
Total Posts: 30200
09 Apr 2014 12:18 PM
you're stopping it and waiting 3 seconds and playing it and then instantly stopping it again
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