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

Working with IntValues but this script wont work?

Asked by 9 years ago

I am trying to make it so when the Value gets Lower then 0 then the Brick disappears.

They are all Parented correctly

Health = script.Parent.Health
ShipExplosionPart = script.Parent.ShipExplosionPart
VorCha = script.Parent.VorCha
if Health.Value <= 0 then
VorCha.Transparency = 1
end

0
Is this the full script? Discern 1007 — 9y
0
Yes that is the full script BearKranz 41 — 9y

1 answer

Log in to vote
0
Answered by
Shawnyg 4330 Trusted Badge of Merit Snack Break Moderation Voter Community Moderator
9 years ago

You need to either put it in a loop, or have a Changed event.

Option 1:

Health = script.Parent.Health
ShipExplosionPart = script.Parent.ShipExplosionPart
VorCha = script.Parent.VorCha
while wait() do
    if (Health.Value <= 0) then
    VorCha.Transparency = 1
end

Option 2:

Health = script.Parent.Health
ShipExplosionPart = script.Parent.ShipExplosionPart
VorCha = script.Parent.VorCha

Health.Changed:connect(function()
    if (Health.Value <= 0) then
        VorCha.Transparency = 1
    end
end)


Ad

Answer this question