So I just started creating a server script for my new game and it’s not working and i don’t know the reason why it’s not printing player when i do player.PlayerAdded
local players = game:GetService("Players")
print('0')
local remotes = replicatedstorage:WaitForChild("Remotes")
local sharedmodules = replicatedstorage:WaitForChild("Modules")
local sharedassets = replicatedstorage:WaitForChild("Assets")
local servermodules = serverstorage:WaitForChild("Modules")
local starter_playervalues = {}
local starter_playerdebounces = {}
print("2")
players.PlayerAdded:Connect(function(player)
print("PLAYER")
end)
I’m guessing some of the things you are calling WaitForChild on don’t exist, so the PlayerAdded event isn’t connecting right away, and the player joins before it got connected.
When a player first joins the game, the WaitForChild functions are called first since they’re in high priority which will yield the script, and will pause until the objects have been found which is not connecting in time to your PlayerAdded event
Can you try this?
local players = game:GetService("Players")
players.PlayerAdded:Connect(function(player)
print("PLAYER")
end)
print('0')
local remotes = replicatedstorage:WaitForChild("Remotes")
local sharedmodules = replicatedstorage:WaitForChild("Modules")
local sharedassets = replicatedstorage:WaitForChild("Assets")
local servermodules = serverstorage:WaitForChild("Modules")
local starter_playervalues = {}
local starter_playerdebounces = {}
print("2")