This is the full script, what I'm trying to do is to make the GUI only appear only once which is when the player joins the game, it is working in Roblox Studio but not in actual Roblox Game.
function onPlayerEntered(newPlayer) wait(.1) local stats = Instance.new("IntValue") stats.Name = "leaderstats" local stats2 = Instance.new("IntValue") stats2.Name = "Tycoon" stats2.Parent = newPlayer stats.Parent = newPlayer wait(.1) local clone=game.ReplicatedStorage:FindFirstChild("GUIs"):FindFirstChild("JoinGui") local player = game.Players.LocalPlayer clone.Parent = player.PlayerGui end game.Players.ChildAdded:connect(onPlayerEntered)
--If your planing to use the onPlayerEntered event then you might as well stick to Script aka Server Sided scripting. --Do not just randomly add **LocalPlayer** and mix it up with server side and client side. function onPlayerEntered(newPlayer) wait(.1) local stats = Instance.new("IntValue") stats.Name = "leaderstats" local stats2 = Instance.new("IntValue") stats2.Name = "Tycoon" stats2.Parent = newPlayer stats.Parent = newPlayer wait(.1) local clone=game.ReplicatedStorage:FindFirstChild("GUIs"):FindFirstChild("JoinGui") local player = newPlayer -- I have changed it to newPlayer since you had the argument setup since before. clone.Parent = player.PlayerGui end game.Players.PlayerAdded:connect(onPlayerEntered) --Also I am changing it to PlayerAdded --if this helped leave a upvote thanks.