Incomplete statement error

So this is the script

im trying to do changing color part

while true do

game.workspace.Part.BrichColor.Random
wait(1)

end

and i keep getting this error
Workspace.Part.Script:3: Incomplete statement: expected assignment or a function call

1 Like

Um it seems you have a typo you put “BirchColor” instead of “BrickColor” xd it happens

3 Likes

But continue you’re doing good for just a day!

its still no[quote=“YT_TacoPlaysRoblox, post:1, topic:1163116”]
e do

i mean this

You haven’t called the function BrickColor.Random()

You’re missing the parentheses that are required to call any function.

oh TYSM so i what do the () do??

The correct code would be

while true do
    game.Workspace.Part.BrickColor = BrickColor.Random()
    wait(1)
end
1 Like

it still have error Random is not a valid member of BrickColor

1 Like

Try this, let me know if it works.

while true do
     game.workspace.Part.BrickColor = BrickColor.random()
     wait(1)
end
2 Likes

ok thank you! It works! Thank you so muchh

2 Likes

Actually now that I look at it a bit more you did some things wrong but it’s just some minor problems.
Lua is very like picky in terms of how you spell things and I see what you did wrong.

when you did

while true do

game.workspace.Part.BrichColor.Random
wait(1)
end

you need to be more specific

you have to also capitalize the “Workspace”

so it would be like this

while true do

game.Workspace.Part.BrickColor = BrickColor.Random()

wait(1)

end

this basically is the right way to say it in lua coding. You have to be specific and you have to watch out for every little detail in terms of spelling, and capitalization.

2 Likes

A set of parentheses at the end indicates a function being run with empty parameters. A function is essentially a block of code that can be remotely called in one line. In this case, the .random() function of BrickColor returns a randomized BrickColor value.

1 Like

Thank yoU Galactiq :smiley: I FIXED the problem now

2 Likes

It’s a lot easier to just type:

workspace.Part

instead of:

game.Workspace.Part
1 Like

Of course I was just making it as similar as possible to his with how he typed it to maybe make it more clear for him since it’s his first day,

2 Likes