Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

how do I give group members ingame tools?

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.

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.

2 comments

0

Do I put it in server script storage or somewhere else, I'm not educated on most of these things.

0

Put it in a server script and pop it into server script storage

This discussion is preserved as it was. New answers, comments, and votes are closed.