Says it in the title.
So, I want to make a sword fighting arena and I have the giving tool bit covered, but now I don't know how to make a part that will remove all the tools in your backpack when you touch it.
Says it in the title.
So, I want to make a sword fighting arena and I have the giving tool bit covered, but now I don't know how to make a part that will remove all the tools in your backpack when you touch it.
It's pretty easy. Make a Touched event, then remove all objects from the players backpack and tools from the character.
local Part = script.Parent
Part.Touched:Connect(function(hit) --"hit" can be named anything.
if hit.Parent and hit.Parent:FindFirstChild('Humanoid') then --Checks if it's a player.
local player = game.Players:GetPlayerFromCharacter(hit.Parent) --Gets the player
for i,v in pairs(player.Backpack:GetChildren()) do --Checks backpack
v:Destroy() --Removes object in Backpack
end
for i,v in pairs(player.Character:GetChildren()) do --Checks character
if v:IsA('Tool') then --Checks if it's a tool
v:Destroy() --Removes object in character
end
end
end
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
Thanks! It worked
np!