I want to make a game to where when someone joins my group they are able to get a gear in game, but I don't know how to script that well.
COMMUNITY QUESTION
how do I give group members ingame tools?
1 answer
local tool = --path to tool
local toolClone = tool:Clone()
local groupId = --group id
local player
game.Players.PlayerAdded:Connect(function(newPlayer) --detect when player joins
player = newPlayer --set player to new player
local character = player.Character or player.CharacterAdded:Wait() --wait until character is loaded in
if player:IsInGroup(groupId) then --check if player is in group
toolClone.Parent = player.Backpack --if in group give them tool
end
end)
player.CharacterAdded:Connect(function() --function fires when they respawn
if player:IsInGroup(groupId) then
toolClone.Parent = player.Backpack
end
end)
I haven't tested this script, let me know if there are any problems.
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
Do I put it in server script storage or somewhere else, I'm not educated on most of these things.
Put it in a server script and pop it into server script storage