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

How do I delete tools when my minigame is finished?

Hi, I've made my own minigame place and don't know how to delete the minigame tools granted to the player. It all works apart from deleting. It is messy, be warned.

game.Players.PlayerAdded:Connect(function(plr)
	print("Greetings from the developer. c:")

while wait(30) do
	local object = math.random(1,2)
	
if object == 1 then
	game.ReplicatedStorage.Plate1:Clone().Parent = workspace.Folder
	
game.ReplicatedStorage.ClassicSword:Clone().Parent = game.Players[plr.Name].Backpack
plr.Character.Torso.Position = Vector3.new(-112, 10, 142.5) 

	wait(30)
	plr.Backpack.ClassicSword:Destroy()
plr.Character.ClassicSword:Destroy()
workspace.Folder.Plate1:Destroy()


elseif object == 2 then	
	game.ReplicatedStorage.Plate2:Clone().Parent = workspace.Folder
game.ReplicatedStorage.ClassicPaintballGun:Clone().Parent = game.Players[plr.Name].Backpack
plr.Character.Torso.Position = Vector3.new(-112, 10, 142.5) 
wait(30)
plr.Backpack.ClassicPaintballGun:Destroy()
plr.Character.ClassicPaintballGun:Destroy()
workspace.Folder.Plate2:Destroy()
end
end
end)

Output on plate2: 14:11:39.238 - ClassicPaintballGun is not a valid member of Model. Does not teleport to plate though, I do not want to ask anyone to anything else apart from the problem fixing.

1 answer

✓ Accepted answer

Just wipe the backpack entirely using

plr.Backpack:ClearAllChildren()

If you have tools they can have in the lobby or something you do have to make sure to re-add those to the player. But this can be done when respawning the players.

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