I am making a game where you should only be able to have certain items at certain times. How do i complete this?
Hi there! If you are wanting to remove every player's items on a game, you would have to use a for loop, which would loop through
game.Players:GetChildren()--This returns a table of ALL the players in the game
Here is an example script for removing all of the players items:
local players = game.Players:GetPlayers() for i,v in pairs(players) do--the variable "v" is equal to the target player v.Backpack:ClearAllChildren()--This removes everything in the targetted players backpack end
To give everyone an item, you would need to define the object you want to give, and then use a for loop again:
local players = game.Players:GetPlayers() local object = definethis for i,v in pairs(players) do local newObj = object:Clone() newObj.Parent = v.Backpack end
Hope this helped!