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

How to take away gear when teleport?

I have put in a teleportation script in my game where you click the GUI and you teleport to a part. But the thing is, I also want the GUI (or Script) to take away the gear that the player has so they can't harm players (It is an AFK Lobby in a murder game. You teleport to the Lobby so that you can't get killed if your AFK, but I don't know how to make it so it takes gear away).

2 comments

2

Use the :Destroy() method.

0

How?

1 answer

To do this you'd have to iterate through all the children of your player's backpack, if any children are tools or hopperbins then destroy them. Same thing with the player's character because the could be equipping something.

plr = --define plr

function noTools(plr)
	for i,v in pairs(plr.Backpack:GetChildren()) do
		if v:IsA('Tool') or v:IsA('HopperBin') then
			v:Destroy()
		end
	end
	for i,v in pairs(plr.Character:GetChildren()) do
		if v:IsA('Tool') or v:IsA('HopperBin') then
			v:Destroy()
		end
	end
end

noTools(plr);

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