Hello all, I'm trying to make it so that when a player joins, the startergui is on their screen. When they click a button, a function is executed. I can't get the StarterGui to show when you join though. I also want to note that I quit roblox & roblox scripting in 2017, and it's a little different now, so sorry if I sound dumb.
Any help will be appreciated, thanks.
game.Players.PlayerAdded:Connect(function(plr)
local ui = plr:WaitForChild("PlayerGui")
for i,v in pairs(game.StarterGui:GetChildren()) do
v:Clone().Parent = ui
end
end)
deb = false
function confirmclick()
deb=true
print("executed")
deb=false
print("Completed, deb completed.")
game.Players.LocalPlayer:Kick("Thank you!")
end
game.StarterGui.main.background.confirmbutton.MouseButton1Click:Connect(confirmclick)

3 comments
StarterGui is a replication container. It’s content is already transferred to PlayerGui; much like the relationship between StarterPack and Backpack.
Basically what Feahren said but more simple: The gui in StarterGui automatically gets parented to PlayerGui when a player joins. There is no reason to make a script that does what Roblox automatically does for you.
Following that, the authentic UI isn’t StarterGui, so your .MouseButton1Click signal won’t ever be fired.