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

Why am I still having trouble getting a gui to pop up on command?

Asked by 5 years ago
Edited 5 years ago

Hi I have asked a few questions about this gui that I have been trying to get to open when prompted to by a serverscript. I have been told to use remote events and the playerGui, both of which I am doing, but still with no luck. I am not getting any error messagaes but all of my prints throughout my script are running so I am guessing it is something wrong with either my local or server script.

Server Script

local t1 = game.Teams.T1
local t2 = game.Teams.T2
local t3 = game.Teams.T3
local t4 = game.Teams.T4
local zoneBind = game:GetService("ReplicatedStorage").ZoneBind
local guiStart = game:GetService("ReplicatedStorage").TeamGuiStart

while true do

--wait for players  
    while true do
        wait(5)
        contestants = {}
        for _, player in pairs(game.Players:GetPlayers()) do
            if player and player.Character then
                local humanoid = player.Character:WaitForChild("Humanoid")
                if humanoid and humanoid.Health > 0 then
                    table.insert(contestants, player)
                end
            end
        end
        if #contestants == 1 then
            break
        end
    end
--open screen gui
    print("The")
    guiStart:FireAllClients()
    print("Lazy")
--zones run 
    zoneBind:Fire()
    print("Dog")
--victor shown
    while true do
        wait(5)

    end
    print("Jumped")
--return to lobby

--wait intermission
wait(30)
end

I'm not done with it yet, the part that isn't working is the line~~~~~~~~~~~~~~~~~guiStart:FireAllClients() ~~~~~~~~~~~~~~~~~. I get all of my prints except Jumped, which is fine because it should be waiting for that loop anyway.

Local Script

local event = game:GetService("ReplicatedStorage").TeamGuiStart

function teamFrameOn()
    local teamFrame = game.Players.LocalPlayer.PlayerGui.GUI    
    teamFrame.Enabled = true
end

event.OnClientEvent:connect(teamFrameOn()

I really don't know the problem when I launch a test and go into my player's playerGui and enable the GUI like this script should be doing it brings the gui up so I'm guessing that's the problem. Thank you! (P.S. I might ask a few more questions today as I promised my partner I would be done with my part by today, Thank you to everyone on the site for being so helpful.)

1 answer

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

Try this at line 28, server script

local plrs = game.Players:GetChildren()
for i = 1, #plrs do
    event:FireClient(plr[i])
end
0
It didn't work. I had the same result toastedtoast224 26 — 5y
0
what does the output says? 0_Halloween 166 — 5y
0
The Lazy Dog lol toastedtoast224 26 — 5y
0
then try making a "for i,v in pairs loop" at line 28, server script 0_Halloween 166 — 5y
View all comments (5 more)
0
I did this for i,v in pairs do guiStart:FireAllClients() end and now im getting an error saying 10:16:54.505 - ServerScriptService.MainScript:28: bad argument #1 to '(for generator)' (table expected, got nil) toastedtoast224 26 — 5y
0
I edited the answer. 0_Halloween 166 — 5y
0
still nothing :( toastedtoast224 26 — 5y
0
Thank you so much for helping though man I really appreciate it. I guess I'll just change the order of the loop if that's what I have to do. toastedtoast224 26 — 5y
0
glad i helped you :D 0_Halloween 166 — 5y
Ad

Answer this question