Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Group rank team only tool not working?

Asked by
Srap_y 0
3 years ago

So i have this script and i modified it, since before it used to give tools to ALL the players, but now i wanted to add a way it only it gives a team only tool, i tried adding some stuff but won't make the script run for some reason, nothing in the output.

local Players = game:GetService("Players")
local GrpId = 0  -- Already Changed

local Items = {
    ["WPN1"] = game.ServerStorage["AR"],
    ["WPN2"] = game.ServerStorage["Pistol"],
    ["WPN3"] = game.ServerStorage["SMG"],
}

local RankItems = {
    [150] = {"WPN1", "WPN2", "WPN3"},
    [160] = {"WPN1", "WPN2", "WPN3"}, -- Team with 10 rank match
    [170] = {"WPN1", "WPN2", "WPN3"},
    [180] = {"WPN1", "WPN2", "WPN3"},
    [190] = {"WPN1", "WPN2", "WPN3"},
    [255] = {"WPN1", "WPN2", "WPN3"},

}

game.Players.PlayerAdded:Connect(function(Player)
    Player.CharacterAdded:Connect(function()
        local GroupRank = Player:GetRankInGroup(GrpId)
        if Player.Team == game.Teams.Carabineros then
        elseif RankItems[GroupRank] then
            for _, item in pairs(RankItems[GroupRank]) do
                Items[item]:Clone().Parent = Player.Backpack
            end
        end
    end)
end)

Answer this question