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 certain players a tool even when they reset?

I've managed to find a script which will check the group and rank of a player, and if it is correct it'll give the player an ID tool. However, this only happens when a new player is added ie. when a new player joins.

Does anyone know what I can add to it so that it'll give the tool to the player again if they reset?

The code:

game.Players.PlayerAdded:Connect(function(plr) if plr:GetRankInGroup(8741653) == 23 then local tool = game.ServerStorage["MilitaryID"]:Clone() tool.Parent = plr:WaitForChild("Backpack") end end)

1 answer

I'll cut right to the point, I fixed this up and added an instant respawn function. (Make sure this is a server script)

--##---[DETECTIVERAIE]---##--
game.Players.PlayerAdded:Connect(function(Player)
	local function giveTool()
		if Player:GetRankInGroup(8741653) == 23 then 
			local tool = game.ServerStorage["MilitaryID"]:Clone() 
			tool.Parent = Player:WaitForChild("Backpack") 
		end 
	end 
	giveTool()
	local Character = workspace:WaitForChild(Player.Name)
	local Humanoid = Character:WaitForChild("Humanoid")
	Humanoid.Died:Connect(function()
		Player:LoadCharacter()
		wait(1)
		giveTool()
	end)
end)

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