For some reason, there is a button in a SurfaceGUI that cannot be deleted across the entire server. This GUI is supposed to be in PlayerGUI, and I have implemented everything successfully except for this feature that will delete a button on the GUI. Using RemoteFunctions seems to be the best option, for now.
--localScript
local requestMPG = game.ReplicatedStorage:WaitForChild("RequestDeleteMPG")
script.Parent.MouseButton1Down:Connect(function()
game.Players.LocalPlayer.Character.MPGA.Disabled = false
local deletion = requestMPG:InvokeServer()
end)
--script
local replicatedStorage = game:GetService("ReplicatedStorage")
local deleteMPG = Instance.new("RemoteFunction")
deleteMPG.Parent = replicatedStorage
deleteMPG.Name = "DeleteMPGRequest"
function delete(player)
print(player .. "has chosen MPG!")
for i, v in pairs(game.Players:GetPlayers()) do
v.PlayerGui.SurfaceGui.screen.grid.tealGreen:Destroy()
end
end
deleteMPG.OnServerInvoke = delete

1 comment
GUIs should be local only the server should not be deleteing GUIs for each player. This should be done in the local script