This is my current script:
local core = script.Parent
local health = script.Parent.health.Value
core.Touched:connect(function(s)
local p = game.Players:getPlayerFromCharacter(s.Parent.Parent)
if (s.Name == "Handle") and (p.TeamColor == BrickColor.new("Bright red")) then
health = health - 20
end
end)
health is the IntValue that's a child of core, it's set at 5000.
Handle is the name of the brick of the sword that I'm using.
I would like it to only decrease health when the player with the sword is on the Bright red team.
Whenever I am testing it, the health value simply stays at 5000 and doesn't decrease, I don't get any errors related to the script in output...

1 comment
Thank you, worked perfectly.