Make team alliance

This script is complex (at least for me) If I don’t want to make it do damage, I just put false?

I presume so, since the function is called CanDamage, so if you return false, no damage, but if you return true, damage. Even the conditions match this. If the player instance in creator has no team or their team is not equal to yours, damage. If needed, I could try and help you out

If you are using the FE gun kit that I used (link above)

I have sent you a request, let’s continue there if needed

The issue has been resolved, what had to be done was changing the ModuleScript that handled damage checking to prevent certain teams from damaging each other

For anyoen curious has to how we did it, here’s the finished changes

local module = {}

local teams = game:GetService("Teams")

local Allies = {
    "MTF",
    "Scientist",
    "Guard",
    "NTF",
    "SeeNoEvil",
    "Alpha",
    "O5",
    "UIU"
}

local Enemies = {
    "ChaosI",
    "DClass",
    "GRUP"
}



module.CanDamage = function(obj, player)
    if obj:FindFirstChild("Humanoid") then
        local p = game.Players:GetPlayerFromCharacter(obj)
        local creator = obj:FindFirstChild("Creator")
        if creator then
            p = creator.Value
        end
        if p then
            if p == player then
                return false
            else
                if p.Neutral or player.Neutral then
                    return true
                elseif p.Team.Name == "SH" or player.Team.Name == "SH" then
                    return true 
                end
                
                if table.find(Allies, player.Team.Name) then
                    if table.find(Allies, p.Team.Name) then --If who we hit is a teammate 
                        return true
                    else
                        return false
                    end
                elseif table.find(Enemies, player.Team.Name) then
                    if table.find(Enemies, p.Team.Name) then
                        return true
                    else
                        return false
                    end
                end
            end
        else
            return true
        end
    end
    return false
end

return module

@Black_Albi please set this as the solution so if anyone stumbles upon this post, they’ll be able to figure how to ignore certain teams by taking inspiration from this method

4 Likes