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

How would you replace a parts RBG color with a RBG color from Replicated Storage?

(Please note that I am new to scripting) I am trying to make a part where when clicked it would change its color depending on the RGB value in Replicated Storage. I have attempted this in the script below but I get the error, "attempt to call a nil value". If anybody more experienced than me in scripting could help me write my code properly, it would overall help me become a better scripter.

while script.Parent.ClickDetector.MouseClick:Wait() do
	script.Parent.Color = Color3.FromRGB(game.ReplicatedStorage.ColorValue.Value)
end

1 answer

✓ Accepted answer

1.) The error means you told the computer to change the color to nothing

2.) I am also new to scripting so forgive me if I am wrong, but I believe but the reason the error is because you are doing all that fancy 'FromRGB' stuff on line 2. If

game.ReplicatedStorage.ColorValue 

is actually a Color3 Value or a BrickColor Value then you shouldn't need that. Therefore, the code would something like this:

while script.Parent.ClickDetector.MouseClick:Wait() do
    script.Parent.Color = game.ReplicatedStorage.ColorValue.Value
end

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