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: How come this isn't working??

Previous Thread :: Next Thread 
Flexes is not online. Flexes
Joined: 13 Apr 2015
Total Posts: 1584
05 May 2015 02:49 AM
Basically, if your health is going down second by second (I have a script already that does that automatically), it will make certain textlabels visible by the number of health you have left. The thing is, it doesn't turn visible, so the script isn't working obviously. Help?

player = game.Players.LocalPlayer
one = script.ScreenGui["seven"]
two = script.ScreenGui["five"]
three = script.ScreenGui["two"]
four = script.ScreenGui["ten"]

while true do
wait(1)
player.Character.Humanoid.Health = player.Character.Humanoid.Health - 10
end
if player.Character.Humanoid.Health <=75 then
wait(0.1)
one.Visible = true
wait(2)
one.Visible = false
elseif player.Character.Humanoid.Health <=50 then
two.Visible = true
wait(2)
two.Visible = false
elseif player.Character.Humanoid.Health <=25 then
three.Visible = true
wait(2)
three.Visible = false
elseif player.Character.Humanoid.Health <=10 then
four.Visible = true
wait(2)
four.Visible = false
end
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
05 May 2015 03:13 AM
Can you make a model of the gui with the scripts so I can look at it?
Report Abuse
Flexes is not online. Flexes
Joined: 13 Apr 2015
Total Posts: 1584
05 May 2015 03:50 AM
http://prntscr.com/71q2jp
http://prntscr.com/71q2l0


Hey there, my name is Flexes. Driving around in my new Lexus.
Report Abuse
Dr01d3k4 is not online. Dr01d3k4
Joined: 11 Oct 2007
Total Posts: 17916
05 May 2015 03:53 AM
Move the if block inside the while block. Because you never break out of the while, the if never gets run.
Report Abuse
Flexes is not online. Flexes
Joined: 13 Apr 2015
Total Posts: 1584
05 May 2015 07:15 PM
I placed the local script in the gui, and it still didn't work. No output. So I decided to change it into 2 local scripts. One with the Health Degeneration, and one with the detection of how low your health is, alerting you with the textlabels becoming visible.

Currently: http://prntscr.com/720flk
Health Degeneration: http://prntscr.com/720fqk
Hunger Detection: http://prntscr.com/720fsd

Still no luck...

Hey there, my name is Flexes. Driving around in my new Lexus.
Report Abuse
Flexes is not online. Flexes
Joined: 13 Apr 2015
Total Posts: 1584
05 May 2015 07:44 PM
bump


Hey there, my name is Flexes. Driving around in my new Lexus.
Report Abuse
GeoVolcano is not online. GeoVolcano
Joined: 05 Jul 2012
Total Posts: 1433
05 May 2015 08:01 PM
while true do
wait(1)
player.Character.Humanoid.Health = player.Character.Humanoid.Health - 10
end

Why?
Report Abuse
Flexes is not online. Flexes
Joined: 13 Apr 2015
Total Posts: 1584
05 May 2015 08:36 PM
cause without it, the script is useless. duh.

and it's just for testing. when your health reaches a certain point, it will appear the alert. Like seriously, this has nothing to do with helping me.


Hey there, my name is Flexes. Driving around in my new Lexus.
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
05 May 2015 08:45 PM
Actually it does have to do with helping you

For the same reason this never prints "hi"


while true do
wait(1)
end

print("hi")


Because the while loop never finished it never moved to the next lines
(As Dr01d3k4 pointed out)


If you fixed that problem and its still not working then make it into a model and I'll try to fix it.
Report Abuse
Flexes is not online. Flexes
Joined: 13 Apr 2015
Total Posts: 1584
06 May 2015 01:27 AM
while true do is seperate from what im trying to make it do. I don't want it all to be combined. Basically the while true do is a seperate script making your health go down (roleplaying hunger).

Then the next code is basically showing alerts that when your health is at this certain amount, it tells you omg u need 2 eat some food!1!1


Hey there, my name is Flexes. Driving around in my new Lexus.
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
06 May 2015 01:59 AM
Well are you expecting it to update whenever the health changes because you only check the health 1 time


local x = 0

if (x == 0) then
print("Zero")
elseif (x == 1) then
print("One")
end
x = 1


Will never print 'One'
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