I made a Health UI... But...
#1
1.) I don't know how to make it so that the script together with the UI will go into the PlayerUI once it enters the game.

2.) Once the player dies, the health bar will stay red. I need it so that it will run again once the player respawns.
Reply
#2
Make it trace the players health, here's a bit of code to help you:
[lua]
--Code above
if player.Health >= 25 then --Assuming you already have the player sorted out
HealthBar.Color = Color(205,25,88) --Assuming the healthbar is one piece.
else
HealthBar.Color = Color(62,190,116)
--Code below
[/lua]
Reply
#3
No... I don't need changing colors. I already have coded it into the script so that it tooltips the player's current health.
Reply
#4
(06-03-2011, 04:09 PM)AK-47 Wrote: No... I don't need changing colors. I already have coded it into the script so that it tooltips the player's current health.

Yeah, I made it so it changes back once you die.

Maybe this would work?

[lua]
--Code
if player.Health = 0 then
HealthBar.Color = Color(green) --Replace green with the RGB.
--Code
[/lua]
Reply
#5
I could give you it in roblox lua, but I can't be bothered to translate.

Assuming the script is in the UI:

[lua]-- Put UI in game.Storage

game.Storage.UI = a
Muffinz(Player)
a.Parent = Player.UI
a.script.Enabled = true (THis will activate the script below)
end

game.Players.PlayerAdded:connect(Muffinz)
[/lua]

As for the resetting, put another script in the UI with this in it :

[lua] while script.Parent.Parent.Parent.Name == Players do
wait (0.1)
if script.Parent.Parent.Character.Health > 1 then
--Reset Gui
end
end
[/lua]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)