I'm trying to make a game where players can battle in this classic place but there are also some minigames for players to play. When players enter the minigames, how do I clear their backpack?
I will assume that you know very little Lua, or Roblox Lua to be more precise.
To start off, you need to have something that the player will touch, likely a part. Position the part at the entrance, so that you know the player will touch it, and place a Script (Server Script) as a child in that part with the following code:
local detection = script.Parent -- A part that the player touches detection.Touched:Connect(function(otherPart) for _,v in pairs(game:GetService("Players"):GetChildren()) do if otherPart:IsDescendantOf(v.Character) then v.Backpack:ClearAllChildren() end end end)
Cheers. Accept this if it helped you.