I'm making a round based BrickBattle like game. So after the intermission, players get teleported to the map, they get they're weapons, game only removes the sword from the inventory but leaves other gear. Here's the script.

for i, player in pairs(game.Players:GetPlayers()) do
	character = player.Character
	
	if not character then
		--Ignore them
	else
		if character:FindFirstChild("GameTag") then
			character.GameTag:Destroy()
		end
		--remove Sword
		if player.Backpack:FindFirstChild("Sword") then
			player.Backpack.Sword:Destroy()
		end
		
			if character:FindFirstChild("Sword") then
			character.Sword:Destroy()
			
		--remove Rocket Launcher
		if player.Backpack:FindFirstChild("RocketLauncher") then
			player.Backpack.RocketLauncher:Destroy()
		end
		
			if character:FindFirstChild("RocketLauncher") then
			character.RocketLauncher:Destroy()
			
		--remove Slingshot
		if player.Backpack:FindFirstChild("Slingshot") then
			player.Backpack.Slingshot:Destroy()
		end
		
			if character:FindFirstChild("Slingshot") then
			character.Slingshot:Destroy()
			
		--remove Superball
		if player.Backpack:FindFirstChild("Superball") then
			player.Backpack.Superball:Destroy()
		end
		
			if character:FindFirstChild("Superball") then
			character.Superball:Destroy()
			
		--remove Bomb
		if player.Backpack:FindFirstChild("Bomb") then
			player.Backpack.Bomb:Destroy()
		end
		
			if character:FindFirstChild("Bomb") then
			character.Bomb:Destroy()
			
		--remove Reflector
		if player.Backpack:FindFirstChild("Reflector") then
			player.Backpack.Reflector:Destroy()
		end
		
			if character:FindFirstChild("Reflector") then
			character.Reflector:Destroy()
			
		end
		
	end
	
	player:LoadCharacter()
end

This is the part that I'm having trouble with, I didn't include the whole script.

1 comment

0

try making it do something where once it gets player it will do .Backpack:ClearAllChildren()