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 11 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
11 years ago

Touch you say?

1script.Parent.Touched:connect(function(hit)
2h = hit.Parent:FindFirstChild("Humanoid")
3 
4if h then
5script.Parent:Destroy()
6end)
0
Sorry, I meant when you touch it with your cursor SparkletimeCrown 0 — 11y
0
Ah, not sure about that. Sorry :p yurhomi10 192 — 11y
0
Okay :/ SparkletimeCrown 0 — 11y
Ad
Log in to vote
1
Answered by 11 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!!!

01local player = game.Players.LocalPlayer
02local mouse = player:GetMouse()
03local human = player.Character:findFirstChild("Humanoid")
04 
05function OnMove()
06    if mouse.Target.className=="Part" then
07            mouse.Target:connect(function(part)
08            local hum = part.Parent:findFirstChild("Humanoid")
09            if hum ~= nil and hum==human then
10                part:remove()
11            end
12        end)
13    end
14end
15 
16mouse.Move:connect(OnMove)
0
Regular script or just local script? SparkletimeCrown 0 — 11y
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 — 11y
0
*Revise* Use a local script because the mouse is a local object. soaprocks2 75 — 11y

Answer this question