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

question, how to fix this IF STATEMENT????

Asked by 5 years ago
Edited 5 years ago

im trying to make a script that if an intvalue is 2, then this brick is not transparent, but it doesn't work. im a beginner dev btw

if script.Parent.IntValue.Value == 2 then
script.Parent.Transparency = 1
end

idk why it doesn't work, any help would be appreciated. thanks!

2 answers

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

Yea the problem is that it only checks once and that is when the player joins try this

while true do

if script.Parent.IntValue.Value == 2 then
script.Parent.Transparency = 1
wait()
else
    script.Parent.Transparency = 0
end
wait()
end
0
tysm! BuzzKillGT 33 — 5y
0
I dont even want to explain why you should NOT use while true do Arkrei 389 — 5y
Ad
Log in to vote
1
Answered by 5 years ago

HI, you forgot to put end. This is the fixed script:

if script.Parent.IntValue.Value == 2 then
    script.Parent.Transparency = 1
end
0
still doesnt work, btw i forgot to put end lol BuzzKillGT 33 — 5y
0
What is the default value for the intvalue? HomieFirePGN 137 — 5y

Answer this question