Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why is Line 3 wrong?

So I have a script. IN the output it says 19:37:53.163 - Workspace.Script:3: 'then' expected near '='. And I figured Line 3 is wrong.

Torso = game.Workspace.Roboy5857.Torso

if Torso.Transparency=0.1 then 
	Torso.Tramsparency=0.1
	wait(0.05)
	Torso.Tramsparency=0.2
	wait(0.05)
	Torso.Tramsparency=0.3
	wait(0.05)
	Torso.Tramsparency=0.5
	wait(0.05)
	Torso.Tramsparency=0.6
	wait(0.05)
	Torso.Tramsparency=0.7
	wait(0.05)
	Torso.Tramsparency=0.8
	wait(0.05)
	Torso.Tramsparency=0.9
	wait(0.05)
	Torso.Tramsparency=1
	wait(0.05)
else
	if Torso.Transparnecy=0 then
		Torso.Transparency=0
	end
end

Why?

3 answers

Most of the time you meant to put "Transparency", you put "Tramsparency".

Because = is used when you want to set a variable, but for logic statements you use ==. Also, you should use loops instead of writings tons of similar commands:

Torso = game.Workspace.Roboy5857.Torso

if Torso.Transparency == 0.1 then 
	for num=1,10 do
	    Torso.Transparency = Torso.Transparency + 0.1
	    wait(0.05)
	end
else
    if Torso.Transparnecy = 0 then
        Torso.Transparency = 0
    end
end


This discussion is preserved as it was. New answers, comments, and votes are closed.