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

Despite no errors in output and everything being set up right, script dosent work?

Asked by 4 years ago

So this is a script inside a part with a clickdetector. it is supposed to make a part is workspace called: "Mask" invisible, but turn it visible If it is visible. but its not working! Help!

if game.Workspace.Mask.Transparency ==1 then
script.Parent.ClickDetector.MouseHoverEnter:Connect(function()

game.Workspace.Mask.Transparency = 0



end)

    else if game.Workspace.Mask.Transparency ==0 then

    script.Parent.ClickDetector.MouseHoverEnter:Connect(function()

game.Workspace.Mask.Transparency = 1



end)

1 answer

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

I fixed up your script and made it look better:

local mask = workspace:WaitForChild("Mask")--You should use "workspace" instead of "game.Workspace", also this line just sets the variable for the mask
script.Parent.ClickDetector.MouseHoverEnter:Connect(function()--Condensing it to 1 connection
    if mask.Transparency == 1 then
        mask.Transparency = 0
    elseif mask.Transparency == 0 then--"else if" is wrong it's supposed to be "elseif"
        mask.Transparency = 1
    end
end)
Ad

Answer this question