The checkpoint is not changing the flag color?

I am making a checkpoint for a 3D platformer game, and I am making a checkpoint that lets you spawn in different spots, of course.

I am trying to make the player that has touched that checkpoint, see the flag change color and not others.

For some reason, my local script is not changing the brick’s BrickColor at all, In fact, it does not even run.

Any help? I already turned off FilteringEnabled under Workspace but it has not seemed to change anything.

local player = game.Players.LocalPlayer

while true do
	if player.PlayerInfo.Checkpoint.Value == script.Parent.Parent.CheckId.Value then
		script.Parent.BrickColor = BrickColor.new("Bright green")
		print("Is on ID!")
	else
		script.Parent.BrickColor = BrickColor.new("Really red")
		print("Not on ID")
	end
	wait()
end

Note: The checkpoint value is to Identify the checkpoint the player is in, since it would be harder to detect Touched event on all of the other checkpoints.

NEVER
NEVER
NEVER

Disable FE! Dont do it! It allows hackers to essentially ruin your game with one line of code. They can change people’s stats and hack in very easy ways.

I enabled it back, now what do I do to change the flag color to one person in a localscript?

Disabling FE does nothing, it’s on by default and is kept on even if you disable it for security purposes. It’s basically a dead Workspace property that really needs to be removed

@ProGaming7894 OP:

Using a loop to check your value is extremely inefficient, this is bad practice. Use a changed event to detect a value change, and if it matches, proceed.

local Player = game:GetService('Players').LocalPlayer
local PlayerInfo = Player:WaitForChild('PlayerInfo')
local CheckId = script.Parent.Parent.CheckId

PlayerInfo.Checkpoint:GetPropertyChangedSignal('Value'):Connect(function()
    if PlayerInfo.Checkpoint.Value == CheckId.Value then
        script.Parent.BrickColor = BrickColor.new("Bright green")
        print('Working')
    else
        script.Parent.BrickColor = BrickColor.new("Really red")
        print('Not working')
    end
end)

The script is not doing anything at all, I even tried making a print("This works") function outside of the function in the script and it did not print anything to the output.

Where is this script located? Keep in mind client scripts don’t run in specific places, like workspace

image
Under the flag object of my model

Is the flag in workspace? If it is, your local script won’t run at all.

image
This counts?

So I’m assuming that’s a yes. Move the script to StarterPlayerScripts

local Player = game:GetService('Players').LocalPlayer
local PlayerInfo = Player:WaitForChild('PlayerInfo')
local CheckId = script.Parent.Parent.CheckId
local Flag = workspace.Flag -- Your flag location

PlayerInfo.Checkpoint:GetPropertyChangedSignal('Value'):Connect(function()
    if PlayerInfo.Checkpoint.Value == CheckId.Value then
        Flag.BrickColor = BrickColor.new("Bright green")
        print('Working')
    else
        Flag.BrickColor = BrickColor.new("Really red")
        print('Not working')
    end
end)
local Player = game:GetService('Players').LocalPlayer
local PlayerInfo = Player:WaitForChild('PlayerInfo')

local Flag = workspace.Checkpoints:GetChildren()-- Your flag location

PlayerInfo.Checkpoint:GetPropertyChangedSignal('Value'):Connect(function()
	for i = 1, #Flag do
		if PlayerInfo.Checkpoint.Value == Flag[i].CheckId.Value then
			Flag[i].Flag.BrickColor = BrickColor.new("Bright green")
			print('Working')
		else
			Flag[i].Flag.BrickColor = BrickColor.new("Really red")
			print('Not working')
		end
	end
end)

This is what worked for me, just putting it to mark it as the solution.

Anyways, Thank you so much for solving my question! You might want to solve the other one I have of a fall damage script I have