script.Parent.MouseButton1Click:connect(function() game.Workspace.Thing:Destroy() end end
so im tryna make a script where if u click a gui it deletes the parts. But i want it to be so that only the person that clicks the gui can see that the parts have dissapeared i do suck but i tried
Hello.
Here is what I have:
script.Parent.MouseButton1Click:connect(function() game.Workspace.Thing:Destroy() end)
Put it in a local script and the person who clicks the gui should only see it removed.
script.Parent.MouseButton1Click:connect(function() game.Workspace.Thing:Destroy() end)
this code does work if placed in a local script, but there is an extra step! this extra step is to either enable 'filtering enabled' which is a property in workspace, you can go to workspace and check that, or you can place the part in the player's camera, meaning you will need to do a bit more, I would use the first one, filtering enabled is helpful, as it will block most exploits used by other players, like song exploits and others, but if you have most of your game made, I would not suggest to do it right now, or you might need to recode the whole game, but remember to enable it on any next project, ill do a quick localscript for the second option.
you will need to place the part you want later deleted in the script and rename the "Thing"s in the script to the part name and place the script in the button
--clone part into camera so other users wont see changes to it script.Thing:Clone().Parent= game.Workspace.CurrentCamera --Delete part when player clicks button script.Parent.MouseButton1Click:connect(function() game.Workspace.CurrentCamera.Thing:Destroy() end)