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

Delete When You Touch That Brick With your cursor?

Asked by 10 years ago

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

2 answers

Log in to vote
2
Answered by
yurhomi10 192
10 years ago

Touch you say?

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

if h then
script.Parent:Destroy()
end)
0
Sorry, I meant when you touch it with your cursor SparkletimeCrown 0 — 10y
0
Ah, not sure about that. Sorry :p yurhomi10 192 — 10y
0
Okay :/ SparkletimeCrown 0 — 10y
Ad
Log in to vote
1
Answered by 10 years ago

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)
0
Regular script or just local script? SparkletimeCrown 0 — 10y
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. soaprocks2 75 — 10y
0
*Revise* Use a local script because the mouse is a local object. soaprocks2 75 — 10y

Answer this question