Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

invincible for 3 seconds?

Asked by
drahsid5 250 Moderation Voter
10 years ago

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)
0
Invisible or Invincible? User#2 0 — 10y

2 answers

Log in to vote
0
Answered by 10 years ago

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)
0
I changed that, still didn't work. drahsid5 250 — 10y
0
Hmm Ill look and see brb DeveloperAtWork 14 — 10y
0
Make it a Local Script... DeveloperAtWork 14 — 10y
0
It is. drahsid5 250 — 10y
View all comments (10 more)
0
Well it's not Erroring for me so... DeveloperAtWork 14 — 10y
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. drahsid5 250 — 10y
0
Ok well i just added the Script that will work. in the comment DeveloperAtWork 14 — 10y
0
That made the head blink, and didn't affect the health. drahsid5 250 — 10y
0
Ok. DeveloperAtWork 14 — 10y
0
Thanks for trying. ;) drahsid5 250 — 10y
0
I fixed it DeveloperAtWork 14 — 10y
0
Still does the same thing. ); drahsid5 250 — 10y
0
Hmm... DeveloperAtWork 14 — 10y
0
Here is what happining: http://www.youtube.com/watch?v=LYdgQ2nTyvs drahsid5 250 — 10y
Ad
Log in to vote
0
Answered by 10 years ago

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

Answer this question