Still have questions? Join our Discord server and get real time help.
Log in to vote

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

Asked by 9 days ago
Edited by raid6n 9 days ago

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

Log in to vote
Answered by
raid6n 2290 Moderation Voter Community Moderator
9 days ago

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)

Answer this question