Make A Checkpoint Change Its Color If The Player Stage is more than X ( Locally )

try printing game.Players.LocalPlayer.leaderstats.Stage.Value in the script if the script doesnt work this shouldnt print

The script didn’t print it out

Try this!

local stage = 16 --Replace 16 by the stage of the checkpoint.
local playerStage = game.Players.LocalPlayer:WaitForChild("leaderstats"):WaitForChild("Stage")

local function ChangeCheckpointColor()
    if playerStage.Value >= stage then
        script.Parent.BrickColor = BrickColor.new("Lime green")
    end
end

ChangeCheckpointColor()

playerStage.Changed:Connect(ChangeCheckpointColor())

I hope this script will help you.

1 Like

The Script, It says Expected EOF got end.

I edited something in my script. It’s should work now.

I put it in the checkpoint as a local script right?

The Script Does not Work though

I made a new script.

local checkpoint = <instance value>  --Replace <instance value> by the checkpoint instance.
local stage =  <number value> --Replace <number value> by the stage of the checkpoint.
local playerStage = game.Players.LocalPlayer:WaitForChild("leaderstats"):WaitForChild("Stage")

local function ChangeCheckpointColor()
    if playerStage.Value >= stage then
        checkpoint.BrickColor = BrickColor.new("Lime green")
    end
end

ChangeCheckpointColor()

playerStage.Changed:Connect(ChangeCheckpointColor())

This must be a local script which must be in StarterCharacterScripts.

1 Like

sorry im noob but what does checkpoint instance mean.

“checkpoint” variable must be an instance value. By example, if the parent of the checkpoint is the Workspace and the name of your checkpoint is “Checkpoint”, the value of “checkpoint” variable must be game.Workspace.Checkpoint. Things like “game.Workspace.Checkpoint” are Instance values.

so i guess the checkpoint value is game.Workspace:WaitForChild(“1”)
?

If your checkpoint name is “1” and his parent is game.Workspace, it’s yes.

The player must reset, only then the checkpoint will change its color

1 Like

There were a problem with .Changed event. Read this porst: .Changed does not fire when connected to local scripts - #3 by madattak

1 Like

Why wont the .Changed event fire

1 Like

Have you tried to reload your saved file after restarting your computer?

reload saved file? How do you do that

He called the function instead of just passing it for the .Changed event.

local checkpoint = <instance value>  --Replace <instance value> by the checkpoint instance.
local stage =  <number value> --Replace <number value> by the stage of the checkpoint.
local playerStage = game.Players.LocalPlayer:WaitForChild("leaderstats"):WaitForChild("Stage")

local function ChangeCheckpointColor()
    if playerStage.Value >= stage then
        checkpoint.BrickColor = BrickColor.new("Lime green")
    end
end

ChangeCheckpointColor()
playerStage.Changed:Connect(ChangeCheckpointColor)

How do you reload a saved file. My obby is a group game

I replaced change with while true do and wait()