So I have a script where when you click it changes a bool value and is supposed to change whether something is visible or not yet it isn't working I tried both else if and elseif --code end but both aren't working, any help?
Discord: Unknown Intelligence#6569
local bool = false
script.Parent.ClickDetector.MouseClick:Connect(function()
local shield = script.Parent.Parent.Part
if bool == false then
shield.Transparency = 1
shield.Transparency = false
bool = true
else if bool == true then
shield.Transparency = 0
shield.CanCollide = true
bool = false
end
end
end)
Using elseif:
local bool = false
script.Parent.ClickDetector.MouseClick:Connect(function()
local shield = script.Parent.Parent.Part
if bool == false then
shield.Transparency = 1
shield.Transparency = false
bool = true
elseif bool == true then
shield.Transparency = 0
shield.CanCollide = true
bool = false
end
end)

1 comment
Thank ya m8y