#Health GUI Script
225 messages · Page 1 of 1 (latest)
like
local hp = 100
local gui = script.Parent
function update()
gui.Text = hp.."/100"
end
update()
hp -= 1
update()
etc
this is what the free model gave me (it had alot more stuff i deleted them)
yes but where?
In a localscript
from here where should i put it
In amountlabel
Ew hp = hp - 1
alright wait
hp-=1*
Good
like this?
yes
now?
Test it
alright wait
nope
i made it full green slider and renamed "n/a" to 100
as u told me
is background the green bar ?
wdym?
K
local hp = 100
local gui = script.Parent
local bar = script.Parent.Parent.Background.Slider
function update()
gui.Text = hp.."/100"
bar.Size = UDium.fromScale(1,hp/100)
end
update()
hp -= 1
update()
wait let me try
** You are now Level 3! **
still doesnt work
mb not slider.Size but bar.Size
still not
Change the size manually in the explorer
size of?
The green bar
or try
local hp = 100
local gui = script.Parent
local bar = script.Parent.Parent.Background.Slider
function update()
gui.Text = hp.."/100"
bar.Size = UDium2.fromScale(hp/100,1)
end
update()
hp -= 1
update()
Anything, just make sure it’s only the green bar, then look what it’s called
So the green bar is probably not slider
Nah I can't
If you want the size of the bar does it work ?
those errors are killing me
i just want this specific gui i wouldn't bother u if i wished to use another one
the red one is for zombie npc to test the health gui working or not
mind showing how this looks?
it's a tad more than 1
neither one of them are for the health gui so idk whats wrong
.
can yall tell me what this is its like 5k times per start
not UDium2
was about to say
alright let me check
local hp = 100
local gui = script.Parent
local bar = script.Parent.Parent.Background.Slider
function update()
gui.Text = hp.."/100"
bar.Size = UDim2.fromScale(hp/100,1)
end
update()
hp -= 1
update()```
here's the fixed version
Yes it works
works like a charm
let me try that
nope
** You are now Level 4! **
local hp = 40
the bar works but when i get damaged
it doesnt do anything
also why does it say 39 when its put on 40
i get -1 hp on the bar
game.Players.LocalPlayer.CharacterAdded:Connect(function(char)
local gui = script.Parent
local bar = script.Parent.Parent.Background.Slider
local function update()
local hp = char.Humanoid.Health
gui.Text = hp.."/100"
bar.Size = UDim2.fromScale(hp/100,1)
end
char.Humanoid.GetPropertyChangedSignal("Health"):Connect(update)
end)
^
quite basic but should work
wtf
too lazy to rewrite the old code, just wrapped it inside a function so it updates on health change
forgot something vital
char.Humanoid
should be working now
still no
?
what do i do
local char = nil
local event = nil
local gui = script.Parent
local bar = script.Parent.Parent.Background.Slider
local function update()
gui.Text = char.Humanoid.Health.."/100"
bar.Size = UDim2.fromScale(char.Humanoid.Health/100,1)
end
game.Players.LocalPlayer.CharacterAdded:Connect(function(c)
char = c
if event then event:Disconnect() end
event = char.GetPropertyChangedSignal("Health"):Connect(update)
end)
still not
does the client know that the health is lost?
Any error ?
Yes
only this that i dont understand what means
cuz there is nothing inside replicatedstorage
so
This problem is from another script
i guess
there is nothing about gui i think let me check
nope
no errors for gui
For character / humanoid?
nope
Print something after char = c and in the function update
yes
does it print?
maybe its cuz i have all these frames, what if i delete them and make a new frame with the same ui
that didn't work aswell btw
Nah don't delete them
event = char.Humanoid:GetPropertyChangedSignal("Health"):Connect(update)
Is it the entire script ?
yes
(with "end)" at the end )
wdym?
add end) at the end
Yes
Go in the explorer -> workspace -> your character then send a screenshot
replace l 13 by
char:WaitForChild("Humanoid"):GetPropertyChangedSignal("Health"):Connect(update)
wtfff mann why wont it work
i did everything
it doesnt wanna work
im telling u its probably because of all these frames this model had alot of stuff inside i removed most of them
ill try to make the gui in 1 frame only wait
if it doesnt work ill undo
nvm
it doesnt work
can anyone come in co op and fix or something
@shut summit any other solutions?
ill just find another ui and it will probably be easier
** You are now Level 5! **
this one is messed up so many frames and stuff
well i gave up on health bar since that was best gui i could find other ones are basic and yea i cant make good ui's
Why give up
I here
When me here
Everything solved
cuz its probably impossible
i imported something and dissapeared
magik
@gloomy mirage im trying to use this model for animation with katana if it works then u can help me with health bar
or if ur good at gui maybe u can help me make one that i want
if not thats alright
I can help healthbar but not katana animation i hate animations
Put ur script here with ur issue, I will check later when I wake up
And no i just
Scripter
bro wdym when u wake up
im gonna be a grandpa by then