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

How do I make a click detector only remove the block for the client that clicked?

Asked by
bailley5 114
4 years ago

this is in a local script inside my part called "Story1"

local clickDetector = game.Workspace.Story1.ClickDetector

clickDetector.MouseClick:Connect(function()
    script.Parent.SurfaceGui.TextLabel.TextTransparency = 1
    script.Parent.SurfaceGui.TextLabel.BackgroundTransparency = 1
    script.Parent.CanCollide = false
    script.Parent.Transparency = 1



end)

2 answers

Log in to vote
1
Answered by 4 years ago
Edited 4 years ago

Hello. It's probably not working because you put the LocalScript in the wrong spot. Put it in StarterPlayer > StarterPlayerScripts. Also, use the destroy function as "SilentsReplacement" said. I hope this helps.

Ad
Log in to vote
0
Answered by 4 years ago

Don't worry, it will only remove it for the client. Assuming that your part is in the workspace, the script would be as follows:

local clickDetector = game.Workspace.Story1.ClickDetector

clickDetector.MouseClick:Connect(function()
    game.Workspace.Block:Destroy() -- Correct this to your block's position
    script.Parent.SurfaceGui.TextLabel.TextTransparency = 1
    script.Parent.SurfaceGui.TextLabel.BackgroundTransparency = 1
    script.Parent.CanCollide = false
    script.Parent.Transparency = 1



end)

Answer this question