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

Delete When You Touch That Brick With your cursor?

How Do you delete a block when someone touches that block with out a delete tool?

2 answers

Touch you say?

script.Parent.Touched:connect(function(hit)
h = hit.Parent:FindFirstChild("Humanoid")

if h then
script.Parent:Destroy()
end)

3 comments

0

Sorry, I meant when you touch it with your cursor

0

Ah, not sure about that. Sorry :p

0

Okay :/

Here is a revise. If the mouse it touching a brick. And you also are touching the brick. It will remove the brick. BEWARE OF BASEPLATE!!!

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local human = player.Character:findFirstChild("Humanoid")

function OnMove()
	if mouse.Target.className=="Part" then
			mouse.Target:connect(function(part)
			local hum = part.Parent:findFirstChild("Humanoid")
			if hum ~= nil and hum==human then
				part:remove()
			end
		end)
	end
end

mouse.Move:connect(OnMove)

3 comments

0

Regular script or just local script?

0

Okay so a local script is used on a client computer. Should be used in script because usually parts are part of the server and not the client unless it is inside a camera or message in the character.

0

Revise Use a local script because the mouse is a local object.

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