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

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

Asked by 6 years ago
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

Log in to vote
5
Answered by
Avigant 2374 Moderation Voter Community Moderator
6 years ago
Edited 6 years ago

== 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
0
Shouldn't Wait() be lowercase? saSlol2436 716 — 6y
0
Well both Wait and wait reference the function, so it's fine. Avigant 2374 — 6y
Ad

Answer this question