How do you make it so that when you input a button it does something (I've covered that) but when you press it again it does something else?
For example, what i've tried is:
if key == "l" then
local part = player.Character.Torso
local lightsource = Instance.new("SurfaceLight")
lightsource.Parent = part
lightsource.Brightness = 2
wait(2)
player.PlayerGui.Light.TextLabel.TextTransparency = 0.1
wait(.1)
player.PlayerGui.Light.TextLabel.TextTransparency = 0.2
wait(.1)
player.PlayerGui.Light.TextLabel.TextTransparency = 0.3
wait(.1)
player.PlayerGui.Light.TextLabel.TextTransparency = 0.4
wait(.1)
player.PlayerGui.Light.TextLabel.TextTransparency = 0.5
wait(.1)
player.PlayerGui.Light.TextLabel.TextTransparency = 0.6
wait(.1)
player.PlayerGui.Light.TextLabel.TextTransparency = 0.7
wait(.1)
player.PlayerGui.Light.TextLabel.TextTransparency = 0.8
wait(.1)
player.PlayerGui.Light.TextLabel.TextTransparency = 0.9
wait(.1)
player.PlayerGui.Light:remove()
else
local light = player.Character.Torso.SurfaceLight
light:remove()
end
end)
I obviously know that 'else' won't work, but i dont know what is the alternate option.
Would be nice if i got some code explaining how it works, or just a brief explanation on what to do.
