I made a script that creates a GUI whenever a player enters the game.
function PlayerAdded(player)
local screengui = Instance.new('ScreenGui', player.PlayerGui)
local msg = Instance.new('TextLabel', screengui)
msg.Text = Player.Name.." has entered the game! Welcome!"
msg.Size = UDim2.new(0, 150, 0, 35)
msg.Position = UDim2.new(0.5, -75, 0, 0)
wait(5)
screengui:Destroy()
end
for _, player in pairs(game.Players:GetPlayers()) do
PlayerAdded(player)
end
game.Players.PlayerAdded:connect(PlayerAdded)
The problem is that the GUI is created WITHOUT the specified properties. So what is created is a ScreenGui with no size, position, or text. How do I fix this?
Also, it's worth noting that the GUI does not disappear.

1 comment
Line 4 typo: "Player" should be "player"