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

On line 6 the output sais : then expected near "=" please help me fix this?

script.parent.Text = "Roblox >"
Wait(1)
script.Parent.TextTransparency = 1
Wait(0.5)
script.Parent.TextTransparency = 0
if script.Parent.Text = color a 
	then script.Parent.TextColor3 = 26, 255, 10
end
	

1 answer

✓ Accepted answer

== is the equality operator, = is the assignment operator. Furthermore, your then should be on the same line as the rest of the if statement:

script.parent.Text = "Roblox >"
Wait(1)
script.Parent.TextTransparency = 1
Wait(0.5)
script.Parent.TextTransparency = 0
if script.Parent.Text = color a 
    then script.Parent.TextColor3 = 26, 255, 10
end

The next problem is that color a is not a valid identifier, so this code still won't work. Remember, an identifier must begin with a letter or underscore, and can be followed by any combination of zero or more letters, underscores, and numbers. Perhaps colorA is what you're looking for.

script.parent.Text = "Roblox >"
Wait(1)
script.Parent.TextTransparency = 1
Wait(0.5)
script.Parent.TextTransparency = 0
if script.Parent.Text == colorA then
	script.Parent.TextColor3 = 26, 255, 10
end

We'll still have another error here, at the line that sets the text color. The property needs to be a Color3, but you're trying to assign it to 26 (remember that in multiple variable assignment, additional results will be discarded). Additionally, Color3 components must be from 0 to 1, not 0 to 255, so we should use the Color3.fromRGB() constructor function:

script.parent.Text = "Roblox >"
Wait(1)
script.Parent.TextTransparency = 1
Wait(0.5)
script.Parent.TextTransparency = 0
if script.Parent.Text == colorA then
	script.Parent.TextColor3 = Color3.fromRGB(26, 255, 10)
end

2 comments

0

Shouldn't Wait() be lowercase?

0

Well both Wait and wait reference the function, so it's fine.

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