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

GUI to delete parts and only person can see it, help?

Asked by 6 years ago

ive asked this b4 but whenever i do the scripts it shows that the part was deleted on the other screen its a local script.

script.Parent.MouseButton1Click:Connect(function()
    game.Workspace.Extra:Destroy()
end)

1 answer

Log in to vote
0
Answered by 6 years ago

Is your game filtering enabled (in other words, experimental mode off)? When filtering is enabled, any actions performed in the client do not replicate to the server and are not shown to other clients (with a few exceptions). Turning this on would make your code only delete the part in the workspace named Extra on the client. To turn it on, click on the Workspace object and set the "FilteringEnabled" property to true. After turning this on, your code would only destroy it for the player who pressed the button.

If you want it to be destroyed for all players, you would have to use the following code to do such that.

-- Script in ServerScriptService
local remote = workspace.DestroyPart - Create a RemoteEvent named DestroyPart

remote.OnServerEvent:Connect(function(plr)
    game.Workspace.Extra:Destroy()
end)
-- Client Script
local remote = workspace.DestroyPart
script.Parent.MouseButton1Click:Connect(function()
    remote:FireServer()
end)
Ad

Answer this question