I have a backpack script. It's suppose to make everything in the backpack be removed.
1 | game.Workspace.Players.Username.Backpack:remove() |
The script returns to false. Why so?
You do not want to remove the backpack itself, just the children in it.
1 | for i,v in pairs (game.Workspace.Players.Username.Backpack:GetChildren()) do v:Destroy() end |
Fixed your errors:
1 | game.Players.PlayerNameHere.Backpack:ClearAllChildren() |
But change PlayerNameHere to the players username
You tried to remove the backpack. Instead, remove its children.
1 | children = game.Workspace.Players.Username.Backpack:GetChildren() |
2 | for k, child in pairs (children) do |
3 | if child:IsA( 'Part' ) and not child.Locked then |
4 | child:Destroy() |
5 | end |
6 | end |
Should be something like that. If it doesn't work, sorry about that. I got it off the wiki and modified it slightly.