of     1   

Cartoonfive
#184547687Monday, February 29, 2016 8:52 PM GMT

Ive been making ^ that kind of script like this: (ive coded it before, but i never saved my progress after i failed, so im just explaining it in english xd) x = 1 clicked function if x = 1 then x = 2 stuff stuff stuff wait end if x = 2 then x = 1 stuff stuff stuff wait end end event caller Thats pretty much what the script is formatted by, and i can clearly tell its inefficient. Lets say x is 1. When i click the brick, x turns to 2 for a split second and does the thing, but then almost immidieately turns back to 1, even though i only clicked it once. Im not that advanced with doing stuff like this yet, or maybe im just missing a critical thing here. wat do?
darthpyro
#184547748Monday, February 29, 2016 8:53 PM GMT

Cartoonfive
#184547843Monday, February 29, 2016 8:55 PM GMT

Since i made the format, i could make an example of actual code: x = 1 local brick = game.Workspace.brick local brick2 = game.Workspace.brick2 function(poop) if x == 1 then x = 2 brick.BrickColor = BrickColor.new("Really red") brick2.BrickColor = BrickColor.new("Lime green") wait(1) end if x == 2 then x = 1 brick.BrickColor = BrickColor.new("Lime green") brick2.BrickColor = BrickColor.new("Really red") wait(1) end end script.Parent.ClickDetector.MouseClick:connect(poop)
Cartoonfive
#184547866Monday, February 29, 2016 8:56 PM GMT

I dont know how to use elseif. Mind giving an example or applying it into my script?
Cartoonfive
#184547923Monday, February 29, 2016 8:57 PM GMT

oh didnt see that link
Cartoonfive
#184548024Monday, February 29, 2016 9:00 PM GMT

I made the example code fast, so i accidentally did function(poop) for the function name. I put it as a parameter and didnt name the function correctly xd it should be function poop() srry and im reading the wiki page rn, thanks for the link, it seems very easy to understand.
Cartoonfive
#184548169Monday, February 29, 2016 9:02 PM GMT

ok, its fixed, thanks!

    of     1