local Part = script.Parent
Part.Touched:connect(function(hit)
local Player = game.Players:GetPlayerFromCharacter(hit.Parent)
If Player then
Player.Backpack:ClearAllChildren()
end
end)
✓ ANSWER ACCEPTED
Trying to make a brick that clears your inventory ,why isn't this working?
1 answer
✓ Accepted answer
local Part = script.Parent
Part.Touched:connect(function(hit)
local Player = game.Players:GetPlayerFromCharacter(hit.Parent)
if Player then -- 'if' starts with a lower case
Player.Backpack:ClearAllChildren()
end
end)
2 comments
0
Ah wow, nice, didn't spot the if.
0
If anything that is usually a color and now is not, reread what you did.
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
I haven't tested this yet - but it's important to note that when a tool is equipped, it is found inside the Character model.