Color Script Doesn't Work

My script is located in starter character and it is supposed to make the colors of the completed stage checkpoints change if the player has completed them

local stages = game.Workspace:WaitForChild("Checkpoints")
local player = game.Players.LocalPlayer
local Stage = player.leaderstats:FindFirstChild("Stage")

for i,stage in pairs(stages:GetChildren()) do
	if tonumber(stage.Name) <= Stage.Value then
		stage.Color = Color3.fromRGB(0,170,0)
	end
end

Are you getting any errors when you run the script? It could be because stage is spelt with a capital S. Variables are case-sensitive, so it matters if you use capital letters or not.

can’t you just say Stage.color = color3.new(0,170,0)?

im not getting any errors when running it

It also works if i change the <= to >= but it changes the wrong parts

Fixed It by adding a wait statement before the code
Thanks for the replies

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.