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

Attempt to call a nil value error when making baseplate random color?

I am trying to make my Baseplate a random color. I put this script in the Baseplate:

local Random = math.random(0, 255)
local Baseplate = game.Workspace:WaitForChild(“Baseplate”)
Baseplate.Color = Color3.FromRGB(Random, Random, Random)

This outputs the following: Workspace.Baseplate.Script:3: attempt to call a nil value(EndOfLine) Stack Begin(EndOfLine) Script ‘Workspace.Baseplate.Script’, Line 3(EndOfLine) Stack End(EndOfLine)

Please help

1 answer

Few problems with your code, you used the wrong quotes and also I dont recommend naming your variables like Random, because it'd just error.

local RandomNumber = math.random(0, 255)
local Baseplate = game.Workspace:WaitForChild("Baseplate")
Baseplate.Color = Color3.fromRGB(RandomNumber, RandomNumber, RandomNumber)

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