Hi, I am new to scripting and usually get help from the wiki but I could not find anything for this topic. Basically, I am trying to create a screen gui that when you press the button once the brick changes it's colour from Medium stone grey to Pastel yellow and the material also changes to neon. Then I want it when I press it again it changes back. I am terrible at scripting and I could not find much on the web, please help me. I had done multiple scripts before but deleted them, this was the one I was working on now:
lit = game.Workspace.IFE_1.yela
thevariable = 5
if thevariable<bob then
script.Parent.MouseButton1Click:connect(function()
lit.BrickColor = BrickColor.new("Pastel yellow")
lit.Material = "Neon"
bob = 6
wait(3)
bob = 1
end) --I thought what was happening was that it ran
-- the code back straight after but I added a wait
-- and nothing happened.
if thevariable>1 then
lit.BrickColor = BrickColor.new("Medium stone grey")
lit.Material = "Plastic"
end
end
Another code: _____________________________
local lit = game.Workspace.IFE_1.yela
local on = true
function on()
on = true
lit.BrickColor = BrickColor.new("Pastel yellow")
lit.Material = "Neon"
print(lit.BrickColor)
print(lit.Material)
end
function off()
on = false
lit.BrickColor = BrickColor.new("Pastel yellow")
lit.Material = "Neon"
print(lit.BrickColor)
print(lit.Material)
end
function onClick()
if on == true then on() elseif on == false then off() end
end
excuse my noobiness :) thanks in advance.

2 comments
I've spent 1 hour on this question lol i tried to avoid using else because i don't find it adjustable. Well done
Ohhh....well I will remember this for the future then, thank you so much, I was spending hours on this!