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: HP Displaying... Not getting why this keeps happening..

Previous Thread :: Next Thread 
GuestCapone is not online. GuestCapone
Joined: 19 Oct 2012
Total Posts: 1928
16 Apr 2013 05:31 PM


repeat wait() until game.Players.LocalPlayer
wait(1)
local player = game:GetService('Players').LocalPlayer
local MaxHealth = player.GuiStats.MaxHP.Value
local WS = player.GuiStats.MaxWS.Value
local Mouse = player:GetMouse()
local camera = workspace.CurrentCamera
local CurrentHP = player.Character.Humanoid.Health

player.Character.Health.Disabled = true
player.Character:FindFirstChild("HealthScript v3.1").Disabled = true
player.PlayerGui.HealthGUI:Destroy()

function MakeArms()
print("No you don't need to see what this function is for. DERP")
end

repeat wait() until game.Players.LocalPlayer.Character.Torso
player.Character.Humanoid.Health = 50
player.Character.Humanoid.MaxHealth = MaxHealth
player.Character.Humanoid.WalkSpeed = WS
MakeArms()

player.Character.Humanoid.Health.Changed:connect()
script.Parent.Health.Text = CurrentHP.." / "..Maxhealth

Output:
17:31:19.280 - Players.Player1.PlayerGui.MainGui.CharacterScript:8: attempt to index field 'Health' (a number value)
17:31:19.281 - Script "Players.Player1.PlayerGui.MainGui.CharacterScript", Line 8
17:31:19.281 - stack end

I would really like to know, why I can't get the script to work.
Report Abuse
KanataIzumi7 is not online. KanataIzumi7
Joined: 08 May 2011
Total Posts: 949
16 Apr 2013 05:34 PM
If you're trying to get rid of the HP bar at the bottom....Try this:



while true do
for inx, val in pairs(game.Players:GetPlayers()) do
if val:FindFirstChild("PlayerGui") then
if val.PlayerGui:FindFirstChild("HealthGUI") then
val.PlayerGui.HealthGUI:Remove()
end
end
end
wait()
end
Report Abuse
GuestCapone is not online. GuestCapone
Joined: 19 Oct 2012
Total Posts: 1928
16 Apr 2013 06:35 PM
Nope, I'm trying to display my current amount of Health next to my Maxhealth value.
But not in bars, I'm wanting to do it in a numerical way. like so :

I currently have 150 out 350 HP so I want my gui's textbox to show like so:
150/350 HP

But, I can't do that cause of the output. :/
Report Abuse
GuestCapone is not online. GuestCapone
Joined: 19 Oct 2012
Total Posts: 1928
16 Apr 2013 07:05 PM
Help
Report Abuse
GuestCapone is not online. GuestCapone
Joined: 19 Oct 2012
Total Posts: 1928
16 Apr 2013 07:22 PM
Do I need to upload the gui?
Report Abuse
MassiveGman is not online. MassiveGman
Joined: 23 Jan 2011
Total Posts: 2019
16 Apr 2013 07:24 PM
Which part of the code is line 8?



|MassiveGman| Scripter & part time Professional Whistler
Report Abuse
CeaselessSoul is not online. CeaselessSoul
Joined: 03 Jul 2012
Total Posts: 7506
16 Apr 2013 07:32 PM
repeat wait()
GUIhere.Text = math.floor(Humanoid.Health).."/"..math.floor(Humanoid.MaxHealth)
until false
Report Abuse
GuestCapone is not online. GuestCapone
Joined: 19 Oct 2012
Total Posts: 1928
16 Apr 2013 10:25 PM
Thanks Cease!
Report Abuse
CeaselessSoul is not online. CeaselessSoul
Joined: 03 Jul 2012
Total Posts: 7506
21 Apr 2013 03:34 PM
Thank you.. It's a gift, :P.
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