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

[UNANSWERED]Remove GUI won't work if there is more then 1 player in server?

Right so, the gui is meant to be removed when it for fills it's purpose, and it will remove BUT only when there is 1 player in the server, This is a localscript within a TextButton, The Gui gets clones to the lighting by a normal script which in my workspace. Thanks for your help. Gui Clone script:

game.Players.PlayerAdded:connect(function(player)
    game.Workspace.Map1.ScreenGui:Clone().Parent = game.StarterGui
end)

Gui script:

repeat wait() until game.Players.LocalPlayer
local i = script.Parent
local map = workspace.Map1.Stadium.sa
local gui = script.Parent.Parent.Parent
local tele1 = game.Workspace.Map1.Tele1
function onButtonClicked()
    local plr = game.Players.LocalPlayer
    local character = plr.Character
if (plr and character ~= nil) then
    character:MoveTo(map.Position)  
    tele1:Clone().Parent = plr.PlayerGui
    script.Parent.Parent.Parent:Destroy()
end
    end
i.MouseButton1Down:connect(onButtonClicked)

1 comment

0

I am guessing this, but please don't be mad, I think you need to add like :Destroy() in order to remove the gui. But I am just guessing so

1 answer

✓ Accepted answer

Your problem is that you are placing the gui in StarterGui, every Gui located in StarterGui is replicated into the localplayer's PlayerGui, if you plan on making changes with the gui use PlayerGui instead!

game.Players.PlayerAdded:connect(function(player)
    game.Workspace.Map1.ScreenGui:Clone().Parent = player:WaitForChild("PlayerGui")
end)

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