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

Group rank, team only items?

Asked by 5 years ago
Edited 5 years ago

Hello all.

As you can most likely tell from the title, I need a script for group rank team only items.

I have an idea as to what it's like but I know that it would not work.

Here is my idea:

local plr = game.Players.LocalPlayer
local grouprank = plr.GetRankInGroup: 4207836
local team = plr.TeamColor

if plr grouprank => 100 then
if plr team = Really black
game.ReplicatedStorage.X26:give
game.ReplicatedStorage.Handcuffs:give
end

Could I get some help? Thanks!

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

Nooooo... you're doing it wrong. You're trying to assign a variable within an if statement, which is bound to throw you an error. You're doing the same for checking their team. Tools don't have a give method, you'll need to clone the tools inside the player's backpack/starter gear. You seem to be using a LocalScript, don't. Put this code in a server script (Script, not local/module) under ServerScriptService

game:GetService("Players").PlayerAdded:Connect(function(plr) 
    local rank = plr:GetRankInGroup(4207836) 

    -- You can also say: plr.GetRankInGroup(plr, 4207836) . The above line is syntax sugar for plr.GetRankInGroup(plr, 4207836)

    if rank >= 100 then 
        -- the > was behind the =, it's >= not =>
        if plr.TeamColor == BrickColor.new("Really black") then
             -- BrickColor constructor

            for _, item in pairs(game:GetService("ReplicatedStorage"):GetChildren()) do
                -- Iterate through the children of replicatedstorage 

                if item.Name == "X26" or item.Name == "Handcuffs" then
                     -- if name is x26 or handcuffs
                    item:Clone().Parent = plr.Backpack
                    item:Clone().Parent = plr.StarterGear
                    -- Create clones of the item, clone to backpack and starter gear. StarterGear cloned the item to the backpack when the humanoid dies. 

                end
            end

        end
    end
end)
1
OOoohhhhh okay I understand where I went wrong. I didn't think the script would be so long! Thanks! Officer_Lost -2 — 5y
Ad

Answer this question