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

"Color3 is not a valid member of Part" error message, can anybody help?

Asked by 4 years ago

So I wanted to make a game where if you touch a brick, the ground/baseplate changes color. The only problem is, whenever my character steps on the brick, an error appears saying "Color3 is not a valid member of Part". I'm new to Lua so my code is probably bad, but here it is:

local Ground = game.Workspace.Ground --Declares local variable for ground
local RGBbrick = game.Workspace.rgb -- Declares local variable for brick which will trigger function

local function onTouch() --Declares function
    while true do
        wait(1)
        Ground.Color3 = Color3.fromRGB(0, 255, 0) -- Makes ground green
        wait(1)
        Ground.Color3 = Color3.fromRGB(18, 238, 212) --Makes ground red
        wait(1)
        Ground.Color3 = Color3.fromRGB(255, 0, 0) -- Makes ground blue
        wait(1)
    end
end

RGBbrick.Touched:connect(onTouch) --Connects function onTouch to touched event

Any help would be appreciated

1
It's not Ground.Color3, it's Ground.Color kisty1 111 — 4y
0
Oh I didn't realize that, thank you. The script finally works now :D Mathenotics 13 — 4y

Answer this question