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

How do you destroy a part locally?

My question is basically, how do you do it? How do you detroy a part locally, so it only is destroyed for the player? Every method I've tried works fine in normal scripts, although to destroy it locally; you have to use a local script, right? It never wants to work though.

--- Only works in a normal script, not in a local one.

local key = game.Workspace.Key

  
key.ClickDetector.MouseClick:Connect(function(player)

print("test")

script.Parent:Destroy()

end)

So, how can you do it? Help is appreciated.

Regards, Simon.

5 comments

0

remote events.

0

Yea use remotes and/or probably more efficient to use :Remove()

0

click detector events can be listened to on the client

0

Remove() is deprecated

0

Dang it @theking i was gonna say taht >:(

1 answer

✓ Accepted answer

to answer your question: yes. you use :Destroy() on an object.

let's say the server makes a part called "Waffle Haus." in the Workspace.

On the localscript, we do this: workspace:WaitForChild('Waffle Haus'):Destroy()

Nobody else will see the part go poof. Only you. This is how people make NoClip exploits n stuff like that. Pretty fancy.

Using remotes is not necessary for what you're doing. Remotes should only be used for "a-b" or "a-a" communication. SO, if we were communicating between players or communicating player-to-server, we'd have to use bindable/remote events. Otherwise, we should just handle it in the localscript.

1 comment

0

Thanks

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