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

How can you add your created tools in a team?

Asked by
KayIum 0
6 years ago
Edited 6 years ago

I have tried many things just to put a self-made weapon in 1 team. Please help me how I can do that. And I know I can just put it in the starterpack but I want only 1 team having it.

1 answer

Log in to vote
0
Answered by 6 years ago

It's not quite as simple as putting it in the starter pack. You will need to check what team the player is on when their character respawns, then put the tool in their Backpack if they are in the correct team.

local team = game.Teams["TeamName"] -- the team that you want to get the tool
local tool = -- (wherever your tool is, I'd recommend putting it in the ServerStorage)

game.Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(character) -- backpack clears when player respawns
        if player.Team == team then 
            local toolClone = tool:Clone()
            toolClone.Parent = player.Backpack
        end
    end
end

This is a really rough script just to demonstrate the concept so don't expect it to work perfectly, of course.

Ad

Answer this question