Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How can I make that when a tool hits a block the block deletes itself?

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 :)

3 comments

0

The script doesnt delete the block

0

It deletes the tool

0

Oh, then make so it checks if it doesn't hit the tool, I'll add that lol

This discussion is preserved as it was. New answers, comments, and votes are closed.