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

i am having an error in my code at the = and all of the code is correct whats happening?

Asked by 7 years ago

ok so i was scripting right because i love roblox (friend me: lukester535 well have a gud teim :) ) and i found an error idk whats happening this works:" function Collide() script.Parent.Transparency = 0 end

script.Parent.ClickDetector.MouseClick:connect(Collide)”

but this:

function Collide() if script.Parent.Transparency = 0 end

script.Parent.ClickDetector.MouseClick:connect(Collide)

doesnt i mean obviosly because i didnt finish but its giving me an error at the “=“ and even if i finish it:

function Collide() if script.Parent.Transparency = 0 then script.Parent.Transparency = 1 end end

script.Parent.ClickDetector.MouseClick:connect(Collide)

i still get it

1
and please write it in te blockcode, where it says lua greatneil80 2647 — 7y

3 answers

Log in to vote
0
Answered by 7 years ago

'=' means a declaration or setting a value, as in

local x = 5

So if it's placed in an 'if' statement it will give an error

'==' means if 2 values are equal, as in

if (x == 5) then

Change your 'if' line to the right equals sign

Ad
Log in to vote
0
Answered by 7 years ago

Hi, next time you type a script please put them in code blocks, way easier to read!

Explanation

If statements use '==' instead of '='

Final script

script.Parent.ClickDetector.MouseClick:connect(function()
    if script.Parent.Transparency == 0 then 
        script.Parent.Transparency = 1
    end
end)

Hope this works, if you need any help or got questions ask em!

~ Arthenix

0
yeah i found out the answer before you responded lukester535 5 — 7y
0
^ Please accept my answer. DjinoKip 78 — 7y
Log in to vote
0
Answered by 7 years ago

thanks anyways

Answer this question