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

I want the inventory to be clear when the player is in lobby?

So I wanted to ask that I want a system in which the player backpack should be there when the player is in the round by if the payer enters the lobby the inventory should be cleared and then when the player teleports to the map again the inventory should be back. Anyone got a code for that?

5 comments

0

Firstly, this isn't a request site. Secondly, what determines "entering"? Is it that they can walk from the map to the lobby, or it is round-based? If so, you can easily call :ClearAllChildren() on their Backpack at the beginning, and instantiate the appropriate assets upon teleportation.

0

To clear a player's inventory you can just destroy all the items inside the backpack of the player, this can be done using the function Instance:ClearChildren(), so what you could do is Player.Backpack:ClearChildren()

0

Pitched_mobile does the part has to cover the whole lobby?

0

Ziffixture it is round based!

0

Pitched_mobile does it bring back the inventory when the player is in the map?

1 answer

✓ Accepted answer

insert a brick into the lobby with cancollide set to false and is transparency to 1, create a script in serverscriptservice and just paste this with ofcourse ur part specified

game.Workspace.Area2.Touched:Connect(function(hit) -- specify your part
	if game.Players:GetPlayerFromCharacter(hit.Parent) then --confirms its a player
		for _,v in pairs(game.Players:GetPlayers()) do
			v.Backpack:ClearAllChildren() --clears backpack
		end
	end
end)

3 comments

0

That clears ALL the players' backpacks

0

And it doesn't get the children back. You should use Region3

0

well u can get the player from the hit and clear that so not much work

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