local G = 7542570 --< Gamepass id game.Players.PlayerAdded:Connect(function(player) game.Players.ChildAdded:Connect(function() local Gam = game:GetService("MarketplaceService") if Gam:UserOwnsGamePassAsync(player.userId , G) then local NewButton = script.ChaosInsurgency:Clone() NewButton.Parent = player.PlayerGui.MainMenu.TeamSelect.Teams end end) end)
I run the game and the Chaos Insurgency Button does not end up where its meant to be when the player joins.
local G = 7542570 local Gam = game:GetService("MarketplaceService") game.Players.PlayerAdded:Connect(function(player) if Gam:UserOwnsGamePassAsync(player.userId , G) then local NewButton = script.ChaosInsurgency:Clone() NewButton.Parent = player.PlayerGui.MainMenu.TeamSelect.Teams end end)
You wrote game.Players.ChildAdded within the game.Players.PlayerAdded, meaning that the player has already been added when the script waits for a child to be added.
And also make sure in future scripts you define "MarketPlaceService" earlier rather than defining it every time.