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

I want to make a part ( Obby checkpoint ) When touch, turn green in color and stay the same way even when the players rejoin. I made a Local Script and put it in the obby checkpoint but it does not work.

while true do
	if game.Players.LocalPlayer.leaderstats.Stage.Value > 0 then
		script.Parent.BrickColor = BrickColor.new("Lime green")
		wait()
	end
end

Im a bad scripter

Did i understand right that you put the local script in Folder of Checkpoints?

I put the local script in the checkpoint

Can you send screenshot of your Checkpoint folder

Screenshot (1700)

Make local script in StarterGui and do

repeat wait() until game.Players.LocalPlayer.leaderstats.Stage

if game.Players.LocalPlayer.leaderstats.Stage.Value > 0 then

workspace:FindFirstChild("1").BrickColor = BrickColor.new("Lime Green")

end

Also this is not the best way to do whatever you want i recommend making Checkpoints folder adding your checkpoints in them and doing for i,v in pairs(CheckpointsFolder:GetChildren()) do

It still dosent change the color

Do you have any errors in output? because i dont see anything wrong with the script

There are no errors in the output

But the


checkpoint still dosent change its color

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.

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.