so i am making a game and the playeradded needs to run for the first person who joins the game how do i make that happen?
This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.
Why was this question closed?
I would recommend using conditional statements along the lines of something like this
local function foo() if #game.Players == 1 then -- code here else return end end game.Players.PlayerAdded:Connect(foo)
From what I can gather, you are trying to run the playeradded event in a local script, hence you are somewhat stating that it isn't running for the first person. This cannot be done as the player is added before the contents of the script are fired.
If for whatever reason you need something to be done on the client through a playeradded event, i'd suggest using a server script, and then firing a remote event to the client.
game:GetService("Players").PlayerAdded:Connect(function(player) game.ReplicatedStorage.PlayerJoined:FireAllClients(player) end)
local event = game:GetService("ReplicatedStorage"):WaitForChild("PlayerJoined") event.OnClientEvent:Connect(function(playerWhoJoined) --your code here end)