How can I make that when a tool hits a block the block deletes itself?
COMMUNITY QUESTION
How can I make that when a tool hits a block the block deletes itself?
1 answer
Assuming you have a handle
serverscript!
local Handle = script.Parent
Handle.Touched:Connect(function(hit)
if hit then
hit:Destroy()
end
end)
You might want to check if the hit isn't a player though!
local Handle = script.Parent
Handle.Touched:Connect(function(hit)
if hit and not hit.Parent:FindFirstChild('Humanoid') then
hit:Destroy()
end
end)
And you should check if the tool doesn't hit... the tool...
local Handle = script.Parent
local Tool = script.Parent.Parent
Handle.Touched:Connect(function(hit)
if hit and not hit.Parent:FindFirstChild('Humanoid') then
if hit ~= Tool and hit ~= Handle then
hit:Destroy()
end
end
end)
If you have any questions, just ask :)
This discussion is preserved as it was. New answers, comments, and votes are closed.

3 comments
The script doesnt delete the block
It deletes the tool
Oh, then make so it checks if it doesn't hit the tool, I'll add that lol