Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Trying to make a brick that clears your inventory ,why isn't this working?

Asked by 7 years ago
local Part = script.Parent
Part.Touched:connect(function(hit)
       local Player = game.Players:GetPlayerFromCharacter(hit.Parent)
       If Player then
             Player.Backpack:ClearAllChildren()
       end
end)
0
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. aztec_glory 63 — 7y

1 answer

Log in to vote
0
Answered by
aiuis 85
7 years ago
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)
0
Ah wow, nice, didn't spot the if. aztec_glory 63 — 7y
0
If anything that is usually a color and now is not, reread what you did. hiimgoodpack 2009 — 7y
Ad

Answer this question