I am trying to erase the extra images of a GUI but it doesn't seem to be working. I've had many trial and errors but it does not fit to my specifications. I want the 'Drop', in fact all of them, to become invisible and visible again. Nothing seems to be working. Here's the script:
local isOn = false
g = game.Players.Player.PlayerGui.SnowGUI:GetChildren()
print("1")
function onTouched()
if isOn == true then off() else on() end
print("2")
end
function on()
isOn = true
game.Players.Player.PlayerGui.SnowGUI.GUI.Disabled = true
game.Players.Player.PlayerGui.SnowGUI.Frame.BackgroundTransparency = 1
print("3")
for i = 1, # g do
if g[i].className == "Drop" then
g[i].Visible = true
end
end
end
function off()
isOn = false
game.Players.Player.PlayerGui.SnowGUI.GUI.Disabled = false
game.Players.Player.PlayerGui.SnowGUI.Frame.BackgroundTransparency = 0.9
print("4")
for i = 1, # g do
if g[i].className == "Drop" then
g[i].Visible = false
end
end
end
print("5")
script.Parent.Touched:connect(onTouched)
on()
`
