I've been trying to make this "capture the flag" game, and when I was testing it I realised that everything was client based, so if the red team captured the flag, then blue came and captured it, it would still appear red to the red team players. Here is my script:
local flag = workspace.Flag
local flagchanger = workspace.CaptureFlag
local player = game.Players.LocalPlayer
local status = game.StarterGui.FlagStatus.Frame.Owner
flagchanger.Touched:Connect(function()
if player.TeamColor == BrickColor.new("Maroon") then
flag.Flag.BrickColor = BrickColor.new("Maroon")
-- other stuff here
print("done")
else
flag.Flag.BrickColor = BrickColor.new("Electric blue")
-- other stuff here
print("done")
end
end)
This script works in a localscript but not in a normal script. What do I need to change to fix this?

2 comments
Don’t use a local script, don’t use local player.
I know but how would I make it so the normal script could find the players TeamColor via the hit function?