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

How to make a GUI show up to all players at the same time?

Asked by 5 years ago
Edited 5 years ago

Hello, I really need help. I really want to know how to make a GUI show up to all the players at the same time. The script is a normal script and it is located in server script.

Here are the details: The Code:

local startGui = game.ServerStorage.StartingGui
local doomGui = game.ServerStorage.DoomMessageGui

while true do
    wait(60)
    for i, v in pairs(game.Players:GetPlayers()) do
        if v:FindFirstChild("PlayerGui") then -- Check for PlayerGui
            local startGuiClone = startGui:Clone()
            startGuiClone.Parent = v.PlayerGui
            wait(1)
            startGuiClone.Frame.Timer.Text = "[9]"
            wait(1)
            startGuiClone.Frame.Timer.Text = "[8]"
            wait(1)
            startGuiClone.Frame.Timer.Text = "[7]"
            wait(1)
            startGuiClone.Frame.Timer.Text = "[6]"
            wait(1)
            startGuiClone.Frame.Timer.Text = "[5]"
            wait(1)
            startGuiClone.Frame.Timer.Text = "[4]"
            wait(1)
            startGuiClone.Frame.Timer.Text = "[3]"
            wait(1)
            startGuiClone.Frame.Timer.Text = "[2]"
            wait(1)
            startGuiClone.Frame.Timer.Text = "[1]"
            wait(1)
            startGuiClone.Frame.Timer.Text = "[0]"
            wait(1)
            startGuiClone:Destroy()
            game.Workspace[v.Name].HumanoidRootPart.CFrame = CFrame.new(game.Workspace.DoomBuilding.TeleportPosition.Position)
            wait(5)
            local doomGuiClone = doomGui:Clone()
            doomGuiClone.Parent = v.PlayerGui
            wait(1)
            doomGuiClone.Text.Text = "Ready"
            wait(1)
            doomGuiClone.Text.Text = "Avoid your Doom!"
            wait(1)
            doomGuiClone:Destroy()
            game.Workspace.DoomBuilding.DoomFloor.CanCollide = false
            game.Workspace.DoomBuilding.DoomFloor.Transparency = 1
            wait(10)
            game.Workspace[v.Name].HumanoidRootPart.CFrame = CFrame.new(game.Workspace.DoomBuilding.SpectatorArea.EndTeleportArea.Position)
            game.Workspace.DoomBuilding.DoomFloor.CanCollide = true
            game.Workspace.DoomBuilding.DoomFloor.Transparency = 0
        end
    end
end

The Output: There was no output

Any help would be appreciated

0
is this a server or local script and where is it located in User#23365 30 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

since your doing this from the server, you could use :FireAllClients() from a RemoteEvent. also use a for loop for the timer. then fire to the server when changing the position of the player.

server

local remote = game.ReplicatedStorage.RemoteEvent -- maybe this was the remote event.
local startGui = game.ServerStorage.StartingGui
local doomGui = game.ServerStorage.DoomMessageGui

spawn(function()
    while true do
        wait(60)
        for _,v in pairs(game.Players:GetPlayers()) do
            local start, doom = startGui:Clone(), doomGui:Clone()

            doom.Enabled = false

            doom.Parent = v.PlayerGui
            start.Parent = v.PlayerGui
        end

       remote:FireAllClients("ChangeStartingGui")
    end
end)

remote.OnServerEvent:Connect(function(player, setPosition)
    if setPosition == "setPosition" then
        player.Character.HumanoidRootPart.CFrame = CFrame.new(game.Workspace.DoomBuilding.TeleportPosition.Position)
    elseif setPosition == "setPosSpectate" then
        player.Character.HumanoidRootPart.CFrame = CFrame.new(game.Workspace.DoomBuilding.SpectatorArea.EndTeleportArea.Position)
    end
end)

client

local remote = game.ReplicatedStorage.RemoteEvent
local player = game.Players.LocalPlayer
local playergui = player.PlayerGui
local startGui = playergui.StartingGui
local doomGui = playergui.DoomMessageGui

remote.OnClientEvent:Connect(function(ChangeStartingGui) -- listens for it
    if ChangeStartingGui == "ChangeStartingGui" then 
        for i = 9,0,-1 do
            startGui.Frame.Timer.text = "["..i.."]" -- use the value to set the timer
            wait(1)
        end
        startGui:Destroy()

        remote:FireServer("setPosition") -- fire to the server 

        doomGui.Enabled = true
        wait(1)
        doomGui.TextShow.Text = "Ready" -- name it to TextShow since the script is gonna get confused if your changing a property or not
        wait(1)
        doomGui.TextShow.Text = "Avoid your Doom!"
        wait(1)
        doomGui:Destroy()

        game.Workspace.DoomBuilding.DoomFloor.CanCollide = false
                game.Workspace.DoomBuilding.DoomFloor.Transparency = 1
        wait(10)
        remote:FireServer("setPosSpectate")
        game.Workspace.DoomBuilding.DoomFloor.CanCollide = true
            game.Workspace.DoomBuilding.DoomFloor.Transparency = 0
    end
end)
0
wtf im not done lol User#23365 30 — 5y
0
done User#23365 30 — 5y
0
Im having problems on where to put the localscript ProvingTrottle 27 — 5y
Ad

Answer this question