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
 

Health Script fix

Previous Thread :: Next Thread 
CrypticFormula is not online. CrypticFormula
Joined: 02 Jul 2009
Total Posts: 302
14 May 2016 08:42 PM
I wanted so when someone has 20 health, it will play music. Here script::


local player = game.Players.LocalPlayer

player.Character.Humanoid.Health.Changed:connect(function()
if player.Character.Humanoid.Health <= 20 then
game.Workspace.Sound:Play(167602797) --change?
end

And tell me whether to put it into local or normal script.

if local script, tell me where to put that local script
Report Abuse
Developmant is not online. Developmant
Joined: 28 Feb 2013
Total Posts: 329
14 May 2016 08:58 PM
well in workspace you need to put the id 167602797 into the SoundId field, and then call it

workspace.Sound:Play()


-- 4 8 15 16 23 42
Report Abuse
CrypticFormula is not online. CrypticFormula
Joined: 02 Jul 2009
Total Posts: 302
14 May 2016 09:20 PM
Don't get what you mean.
Report Abuse
ExpensiveGaming is not online. ExpensiveGaming
Joined: 01 Apr 2013
Total Posts: 783
14 May 2016 09:38 PM
Put the ID in the 'SoundID' property.

Then use the inbuilt function :Play() on the sound object.


R$2,200 lol im poor
Report Abuse
scottmike0 is not online. scottmike0
Joined: 14 Sep 2008
Total Posts: 1073
14 May 2016 09:40 PM
there is no param in play.
Report Abuse
Nicollye7074 is not online. Nicollye7074
Joined: 15 Feb 2014
Total Posts: 198
15 May 2016 08:04 AM

local player = game.Players.LocalPlayer
repeat wait() until player.Character.Humanoid

player.Character.Humanoid.Changed:connect(function() -- Health has no .Changed property so
-- just put Humanoid.Changed
if player.Character.Humanoid.Health <= 20 then
game.Workspace.Sound:Play() -- Create a sound in the workspace and put the id of the song --in the soundid field
end

end)


--Put this in a local script
Report Abuse
CrypticFormula is not online. CrypticFormula
Joined: 02 Jul 2009
Total Posts: 302
15 May 2016 12:22 PM
Two questions:


1. Do I have to Put The Music ID between the parenthesis in::: Play()?

2. Where do I put this local script. Workspace? Players?
Report Abuse
CrypticFormula is not online. CrypticFormula
Joined: 02 Jul 2009
Total Posts: 302
15 May 2016 12:23 PM
Nevermind the first Question.
Report Abuse
CrypticFormula is not online. CrypticFormula
Joined: 02 Jul 2009
Total Posts: 302
15 May 2016 12:40 PM
b1
Report Abuse
Nicollye7074 is not online. Nicollye7074
Joined: 15 Feb 2014
Total Posts: 198
15 May 2016 01:05 PM
Better put the localscript in the starterpack or startergui.
Js.
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