I am making a script for a terminal/flag that your team captures. This is a local script in Starterpack. Here's the script:
plr = game.Players.LocalPlayer
char = plr.Character
tc = plr.TeamColor
while true do
if game.Workspace.Terminal then -- If the gamemode is Terminal
terminal = game.Workspace.Terminal
wait(1)
local magnitude = (char.Torso.Position - terminal.Flagpole.Position).magnitude
if magnitude <= 35 then
print("Player near terminal")
if tc == BrickColor.new(21) then
print(plr.TeamColor)
terminal.captureprogress.Value = terminal.captureprogress.Value + 1
print(terminal.captureprogress.Value)
else
print(plr.TeamColor)
terminal.captureprogress.Value = terminal.captureprogress.Value - 1
print(terminal.captureprogress.Value)
end
end
end
end
The problem is this block:
if tc == BrickColor.new(21) then
print(plr.TeamColor)
terminal.captureprogress.Value = terminal.captureprogress.Value + 1
print(terminal.captureprogress.Value)
else
print(plr.TeamColor)
terminal.captureprogress.Value = terminal.captureprogress.Value - 1
print(terminal.captureprogress.Value)
The capture progress is an intvalue and the value should be getting bigger when a red team is near the terminal and if the other teams go near the terminal the intvalue's value gets smaller. But in game it gets bigger even if i'm on the other team... The script does recognize I'm on the other team because it prints my TeamColor but the value doesn't decrease.
I changed the BrickColor.new(21) to a BrickColor.new(2) (which isn't a color, and the number was subtracting.)
Any ideas how I could approach this issue?

3 comments
You are supposed to use a Server Script for this stuff >.>
I changed it to a server script and it still had the same problem. Dx
A ServerScript inside Workspace, preferrably the terminal >.>