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: Why wont this work?

Previous Thread :: Next Thread 
NotPix is not online. NotPix
Joined: 27 Nov 2008
Total Posts: 259
27 Dec 2013 09:09 AM
Can someone explain to me, why this wont work?



repeat wait()until script.Parent:FindFirstChild("HealthGUI")
repeat wait()until game.Players.LocalPlayer.Character
player = game.Players.LocalPlayer
char = player.Character
repeat wait()until char.Humanoid
human = char.Humanoid
gui = script.Parent.HealthGUI

script.Sound:Play()

human.HealthChanged:connect(function()
script.Sound.Volume = human.MaxHealth/human.Health
end)
Report Abuse
Epic1230 is not online. Epic1230
Joined: 07 Dec 2011
Total Posts: 289
27 Dec 2013 09:15 AM
Is your script a LocalScript?
Report Abuse
NotPix is not online. NotPix
Joined: 27 Nov 2008
Total Posts: 259
27 Dec 2013 09:27 PM
yes it is.
Report Abuse
NotPix is not online. NotPix
Joined: 27 Nov 2008
Total Posts: 259
27 Dec 2013 09:27 PM
and it is found in the startergui
Report Abuse
NotPix is not online. NotPix
Joined: 27 Nov 2008
Total Posts: 259
28 Dec 2013 12:31 PM
does anyone know how to fix this?
Report Abuse
RoflBread is not online. RoflBread
Joined: 18 Jun 2009
Total Posts: 3803
28 Dec 2013 12:34 PM
script.Sound.Volume = (human.Health / human.MaxHealth) * 100
Report Abuse
NotPix is not online. NotPix
Joined: 27 Nov 2008
Total Posts: 259
28 Dec 2013 08:26 PM
Wait a minute now... Now how could i have it so its stops playing the sound after the humanoid health reaches 90 again? Also any idea on how to go about adjusting the pitch higher as your health gets lower?
Report Abuse
NotPix is not online. NotPix
Joined: 27 Nov 2008
Total Posts: 259
02 Jan 2014 07:48 PM
bump
Report Abuse
DrRandomous is not online. DrRandomous
Joined: 25 Mar 2011
Total Posts: 1702
02 Jan 2014 07:49 PM
while health < 90 do
end
Report Abuse
WillScriptForFood is not online. WillScriptForFood
Joined: 03 Aug 2013
Total Posts: 701
02 Jan 2014 07:52 PM
Pro scripting. :)



local p = game:GetService('Players').LocalPlayer
local h = p.Character.Humanoid

local cP = false
local oH = h.Health

h.HealthChanged:connect(function(nH)
if (nH < 90) nad (not cP) then
script.Sound:Play()
elseif (nH > 90) and (cP) then
script.Sound:Stop()
end end)
Report Abuse
WillScriptForFood is not online. WillScriptForFood
Joined: 03 Aug 2013
Total Posts: 701
02 Jan 2014 07:52 PM
Nevermind, near-completely failed.
This is pro scripting. :)


local p = game:GetService('Players').LocalPlayer
local h = p.Character.Humanoid

local cP = false

h.HealthChanged:connect(function(nH)
if (nH < 90) nad (not cP) then
script.Sound:Play()
cP = true
elseif (nH > 90) and (cP) then
script.Sound:Stop()
cp = false
end end)
Report Abuse
NotPix is not online. NotPix
Joined: 27 Nov 2008
Total Posts: 259
10 Jan 2014 11:46 PM
it seems to break after it goes through once. hmm
Report Abuse
WillScriptForFood is not online. WillScriptForFood
Joined: 03 Aug 2013
Total Posts: 701
14 Jan 2014 06:56 PM
Yeah, "nad" instead of "and", as well as using the undefined variable "nH".
Also, apologies for the wait.



local p = game:GetService('Players').LocalPlayer
local h

if (not p.Character) then
p.Character:wait()
h = p.Character.Humanoid
else
h = p.Character.Humanoid
end

local cP = false

if (h) then
h.HealthChanged:connect(function(nH)
local volume = h.MaxHealth / h.Health * 10

if (h.Health < 90) and (not cP) then
script.Sound.Volume = volume
script.Sound:Play()
cP = true
elseif (h.Health > 90) and (cP) then
script.Sound:Stop()
cp = false
end end)
Report Abuse
NotPix is not online. NotPix
Joined: 27 Nov 2008
Total Posts: 259
18 Jan 2014 01:52 PM
ah okay thanks a lot :)
Report Abuse
WillScriptForFood is not online. WillScriptForFood
Joined: 03 Aug 2013
Total Posts: 701
22 Jan 2014 07:52 AM
Found yet another error...



local p = game:GetService('Players').LocalPlayer
local h

if (not p.Character) then
p.Character:wait()
end

h = p.Character:FindFirstChild('Humanoid')


local cP = false

if (h) then
h.HealthChanged:connect(function(nH)
local volume = h.MaxHealth / h.Health * 10

if (h.Health < 90) and (not cP) then
script.Sound.Volume = volume
script.Sound:Play()
cP = true
elseif (h.Health > 90) and (cP) then
script.Sound:Stop()
cP = false
end end)
Report Abuse
vlekje513 is not online. vlekje513
Joined: 28 Dec 2010
Total Posts: 9057
22 Jan 2014 08:18 AM
Omg ._.

Its him.
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