(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.) 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