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: Need help with this script

Previous Thread :: Next Thread 
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
08 Jul 2011 05:43 PM
It works, but it doesn't work the way I want

HealthValue=Instance.new("NumberValue")
HealthValue.Name=("HealthValue")
HealthValue.Parent=script.Parent.Parent.Parent.Character
while wait() do
Health=script.Parent.Parent.Parent.leaderstats.Level.Value+100*script.Parent.Parent.Parent.leaderstats.Level.Value/2-script.Parent.Parent.Parent.leaderstats.Level.Value
HealthValue.Value=Health
script.Parent.Parent.Parent.Character.Humanoid.MaxHealth=HealthValue.Value
end
repeat wait() until script.Parent.Parent.Parent:findFirstChild("Has2")~=nil
if script.Parent.Parent.Parent:findFirstChild("Has2")~=nil then
HealthValue.Value=HealthValue.Value+50
end

I go up +50 health, but only for a very slight second. This is because it goes over the script again, and makes it go to the first value it was at before it was +50.

How can I get it to stay at +50 without going over and restarting at the original value again?
Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
08 Jul 2011 06:02 PM
Bump
Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
08 Jul 2011 06:23 PM
Bump :/
Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
08 Jul 2011 06:31 PM
Oops, forgot to say please.

Please?
Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
08 Jul 2011 06:55 PM
Bump...

It's been awhile ;/
Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
08 Jul 2011 07:00 PM
Been 20 minutes... Scripting Helpers is inactive nowadays. Where did all the scripters go...?
Report Abuse
TwoBoo is not online. TwoBoo
Joined: 08 Feb 2011
Total Posts: 10790
08 Jul 2011 07:01 PM
They all went to
http://www.roblox.com/Forum/ShowForum.aspx?ForumID=33

:(
Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
08 Jul 2011 07:05 PM
Two, unfortunately I quit for 7 months, so i lost most of my scripting knowledge. Although it's coming back to me slowly but surely.
Report Abuse
dekkonot is not online. dekkonot
Joined: 22 Dec 2010
Total Posts: 6685
08 Jul 2011 07:29 PM
I wish I knew the answer. But, I find it hard to think about scripts that aren't mine...
Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
08 Jul 2011 08:57 PM
Alright, thanks dekkonot.

Bump
Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
08 Jul 2011 09:03 PM
Still no one...
Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
08 Jul 2011 09:11 PM
Bump...!
Report Abuse
Robertoman is not online. Robertoman
Joined: 10 May 2007
Total Posts: 6369
08 Jul 2011 09:19 PM
addition=0
HealthValue=Instance.new("NumberValue")
HealthValue.Name=("HealthValue")
HealthValue.Parent=script.Parent.Parent.Parent.Character
while wait() do
Health=script.Parent.Parent.Parent.leaderstats.Level.Value+100*script.Parent.Parent.Parent.leaderstats.Level.Value/2-script.Parent.Parent.Parent.leaderstats.Level.Value+addition*50
HealthValue.Value=Health
script.Parent.Parent.Parent.Character.Humanoid.MaxHealth=HealthValue.Value
end
if script.Parent.Parent.Parent:findFirstChild("Has2")~=nil then
addition.Value=1
end
Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
08 Jul 2011 09:29 PM
Roberto, did the same thing :/
Report Abuse
Robertoman is not online. Robertoman
Joined: 10 May 2007
Total Posts: 6369
08 Jul 2011 09:33 PM
Then you have a different loop effecting their health.
Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
08 Jul 2011 09:34 PM
@Roberto, cancel that last post. I logged out on roblox for studio, and I didn't save properly.
Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
08 Jul 2011 09:35 PM
And cancel that last last post.

It did do the same thing :/
Report Abuse
Robertoman is not online. Robertoman
Joined: 10 May 2007
Total Posts: 6369
08 Jul 2011 09:38 PM
Lol, then something else in your scripts are effecting their health.
Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
08 Jul 2011 09:39 PM
I don't think so.

I think I'll add a another value, kind of what you did.
Report Abuse
Bubby4j is not online. Bubby4j
Joined: 25 Dec 2008
Total Posts: 1831
08 Jul 2011 09:41 PM
Check the output, no errors? Put in prints to trace the line of execution.
Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
08 Jul 2011 09:42 PM
Bubby, already did, no output.

I'm going to try


HealthAdded=Instance.new("NumberValue")
HealthAdded.Name=("HealthAdded")
HealthAdded.Parent=script.Parent.Parent.Parent.Character
while wait() do
Health=script.Parent.Parent.Parent.leaderstats.Level.Value+100*script.Parent.Parent.Parent.leaderstats.Level.Value/2-script.Parent.Parent.Parent.leaderstats.Level.Value+HealthAdded.Value
HealthValue.Value=Health
script.Parent.Parent.Parent.Character.Humanoid.MaxHealth=HealthValue.Value
end
if script.Parent.Parent.Parent:findFirstChild("Has2")~=nil then
HealthAdded.Value=50
end
Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
08 Jul 2011 09:43 PM
Oops, again, cancel that script, forgot to add the other value.
Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
08 Jul 2011 09:47 PM
This worked, but whenever I level up, my health doesn't go up.
I really wish I could use output more often, but the leaderstats never load.


HealthValue.Name=("HealthValue")
HealthValue.Parent=script.Parent.Parent.Parent.Character
HealthAdded=Instance.new("NumberValue")
HealthAdded.Name=("HealthAdded")
HealthAdded.Parent=script.Parent.Parent.Parent.Character
while wait() do
Health=script.Parent.Parent.Parent.leaderstats.Level.Value+100*script.Parent.Parent.Parent.leaderstats.Level.Value/2-script.Parent.Parent.Parent.leaderstats.Level.Value+HealthAdded.Value
HealthValue.Value=Health
script.Parent.Parent.Parent.Character.Humanoid.MaxHealth=HealthValue.Value
end
if script.Parent.Parent.Parent:findFirstChild("Has2")~=nil then
HealthAdded.Value=50
end


Any way to fix this new problem?
Report Abuse
Robertoman is not online. Robertoman
Joined: 10 May 2007
Total Posts: 6369
08 Jul 2011 09:48 PM
When is this function called, is it in a loop?
Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
08 Jul 2011 09:51 PM
It's just a simple loop.

It gives you health based on the level you are, and if you have something called "Has2" in your player, you get extra health.

The extra health thing works, but it breaks the adding health.
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