hey fellas.
I am trying to give a part a team, and take damage from people who hit it who are not on the part’s team.
.
I put a BrickColor value under the part, the value is “Really Red”, and i put a BrickColor value under team blue, “Really Blue” and under team red “Really Red”. The other value under the part, RedPartHealth, is the amount of health the part has.
The part is obviously on the red team. i want to have the part take damage from people on the blue team and not on the red team, but i am not sure where to go next with my code, as you can see below.
local part = script.Parent
local partTeam = script.Parent.Value.Value
local red = game.Teams.Red.Value
local blue = game.Teams.Blue.Value
local PartHealth = script.Parent.RedPartHealth.Value --1000 health
local function OnTouch(otherPart)
-- Get the other part's parent
local partParent = otherPart.Parent
-- Look for a humanoid in the parent
local humanoid = partParent:FindFirstChildWhichIsA("Humanoid")
if humanoid then
local char = otherPart.Parent
local player = game:GetService("Players"):GetPlayerFromCharacter(char)
if player.TeamColour ~= partTeam then
end
end
end
end
Where should I go next? I want to also hook this up to a health bar, i would assume i do that using UIGradients or something?