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

PlayerAdded Event GUI popup doesn't work, Why?

Asked by 4 years ago
Edited 4 years ago

I am now working on that a player joins the game and a GUI/UI will popup, but it doesn't work..

Here's the code

local Players = game:GetService("Players")
local Main = game.StarterGui.Menu.Main


function playerAdded(player)
    Main.Visible = true 
    print("hey its ur boi testing")
end
game.Players.PlayerAdded:Connect(playerAdded)

and btw It doesn't even print it. + There is no errors

0
is this a local script? asdfghjk9019 225 — 4y
0
this is a server script in a GUI https://gyazo.com/f31969efd132000d39478f3e55d9531a TheEmperorDupled 2 — 4y
0
what is menu,is it a screen gui? asdfghjk9019 225 — 4y
0
i know what is the problem check out my answer asdfghjk9019 225 — 4y

2 answers

Log in to vote
0
Answered by 4 years ago
local Players = game:GetService("Players")
local Main = game.StarterGui.Menu.Main--this is the gui that is in starter gui but not what is in the players gui

--starter gui is a service that clones all what is in it o the player that joined so if you are making it visible its not making the clones it just make what is in starter gui visible


--this should work
function playerAdded(player)
    player.PlayerGui.Menu.Main.Visible = true
    print("hey its ur boi testing")
end
game.Players.PlayerAdded:Connect(playerAdded)
Ad
Log in to vote
0
Answered by 4 years ago
Edited 4 years ago
local Players = game:GetService("Players")
local Main = game.StarterGui.Menu.Main


function playerAdded(player)
    player.PlayerGui.Menu.Main.Visible = true
    print("hey its ur boi testing")
end
game.Players.PlayerAdded:Connect(playerAdded)

Try this it might not work but it doesnt know what Main.Visible is so referencing Gui will fix it I think sorry if It doesnt work ill find other solution.

0
Main is the frame TheEmperorDupled 2 — 4y

Answer this question