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

Need a script about a character only having one gear at a time?

i need a script -- Once another gear is equipped then the gear that you originally had disappears. WHICH only allows person to have 1 gear at a time until new one is added to the backpack.So when the new one is added the one you had vanishes and you only have the gear you just got.

1 answer

✓ Accepted answer

Here, What this script will do, what i'm guessing you're asking for is, when a tool is added to player's backpack, any tool/tool he is currently using will be removed.

Place this code inside a localscript inside starterpack.

game.Players.LocalPlayer.Backpack.ChildAdded:connect(function(c)
	for _,v in pairs(game.Players.LocalPlayer.Backpack:GetChildren()) do
		if v~=c and v~=script and v:IsA("Tool") then
			v:Destroy()
		end
	end
	if workspace:FindFirstChild(game.Players.LocalPlayer.Name)~=nil then
		for _,vv in pairs(workspace:FindFirstChild(game.Players.LocalPlayer.Name):GetChildren()) do
			if vv:IsA("Tool") then
				vv:Destroy()
			end
		end
	end
end)

If you need any help please ask.

1 comment

0

Providing code without an explanation is redundant and pretty much helps no one. Don't bother answering request questions anyways dude.

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