Hello, i am having a problem with this script, it is a script to pick up a flag and lower a value, but that is not a problem, it is a function to stop the same team from picking up their own flag. It always prints invalid (that i have put to check), even if i am in the opposite team.
Here's the code:
function checkplayer(hit)
local player = players:GetPlayerFromCharacter(hit.Parent)
local playername = hit.Parent.Name
local human = hit.Parent:FindFirstChild("Humanoid")
if human then
if not players[playername].TeamColor == BrickColor.new("Bright blue") then
ontouchorremove()
print("valid")
else
print("invalid")
end
end
end
script.Parent.Touched:Connect(checkplayer)

4 comments
I think you could swap BrickColor.new("Bright blue") for just == "Bright blue" and make sure everything was wrote right
i already did that
...And?
nope, still the same