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 » Scripters
Home Search
 

Re: Need help with music script!

Previous Thread :: Next Thread 
NobleTester is not online. NobleTester
Joined: 02 Aug 2012
Total Posts: 81
10 May 2015 03:45 PM
Keeping post short and understandable.
Please do not post if you're going to give me an unintelligent or non-serious answer.

I'm trying to make a script where when you touch a brick it stops the current sound playing and plays the one in the script.

Ex.
Player 1 steps on Brick X which stops playing music from Brick Y and plays music inside Brick X's script.

It should be easy.

function Brick(hit)

game.Workspace.MusicBlock.sound:Play()

end

script.Parent.Touched:connect(Brick)
Report Abuse
NobleTester is not online. NobleTester
Joined: 02 Aug 2012
Total Posts: 81
14 May 2015 03:00 PM
bump
Report Abuse
Klink45 is not online. Klink45
Joined: 06 Jun 2011
Total Posts: 26054
14 May 2015 03:18 PM
function onTouch(part)
local humanoid = part.Parent:FindFirstChild("Humanoid")
if (humanoid ~= nil) then -- if a humanoid exists, then
local NewSound = Instance.new("Sound")
NewSound.SoundId = "ID"
Sound:Stop
NewSound:Play()
end
end

script.Parent.Touched:connect(onTouch)
Report Abuse
NobleTester is not online. NobleTester
Joined: 02 Aug 2012
Total Posts: 81
20 May 2015 07:40 PM
Doesnt work.
Report Abuse
NobleTester is not online. NobleTester
Joined: 02 Aug 2012
Total Posts: 81
22 May 2015 06:16 PM
Bump.
Report Abuse
NinjaFlamez is not online. NinjaFlamez
Joined: 03 Oct 2012
Total Posts: 132
22 May 2015 06:17 PM
You connected a hit function with touched, you have to use either or
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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