Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

invincible for 3 seconds?

I made a script for my custom health bar to make my player invincible for 3 seconds... didn't work, no output errors. Anyone know whats wrong? script:

local Plr = game.Players.LocalPlayer
local Char = Plr.Character
script.Parent.Changed:connect(function(val)

if script.Parent.Value >0 then
local Health = script.Parent.Value
for index, child in pairs(Char:GetChildren()) do
if child:IsA("Part") then
while wait(3) do	
if val ~= Health then
script.Parent.Value = Health
child.Transparency = 0
wait(0.35)
child.Transparency = 1
elseif val == Health then	
child.Transparency = 0
wait(0.35)
child.Transparency = 1
wait() -- anti freeze	
end	
end
chilf.Transparency = 1
end
end
end
end)

1 comment

0

Invisible or Invincible?

2 answers

This will work I fixed it

local Plr = game.Players.LocalPlayer
local Char = Plr.Character
script.Parent.Changed:connect(function(val)

if script.Parent.Value >0 then
local Health = script.Parent
for index, child in pairs(Char:GetChildren()) do
if child:IsA("Part") then
while wait(3) do    
if val ~= Health.Value then
script.Parent.Value = Health.Value
child.Transparency = 0
wait(0.35)
child.Transparency = 1
elseif val == Health.Value then   
child.Transparency = 0
wait(0.35)
child.Transparency = 1
wait() -- anti freeze   
end 
end
child.Transparency = 1
end
end
end
end)

14 comments

0

I changed that, still didn't work.

0

Hmm Ill look and see brb

0

Make it a Local Script...

0

It is.

0

Well it's not Erroring for me so...

0

The character is 'sposed to become non-transparent, and visible rapidly for 3 seconds when a INT value changes/gets lower. It doesn't work for me.

0

Ok well i just added the Script that will work. in the comment

0

That made the head blink, and didn't affect the health.

0

Ok.

0

Thanks for trying. ;)

0

I fixed it

0

Still does the same thing. );

0

Hmm...

0

If it's a local script just add a wait(2) at the very start of the script and it should work.

This discussion is preserved as it was. New answers, comments, and votes are closed.