PlayerAdded won't run?

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I want to make a leaderstats script that makes a new folder and new value to put into the folder

  2. What is the issue? Include screenshots / videos if possible!
    Script doesn’t detect that a player has joined the game

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    Looked on devforum and could find no solutions

local DSS = game:GetService("DataStoreService")
local DataStore = DSS:GetDataStore("leaderstats")

function loadleaderstats(player)
	print(player.Name.." has joined the game")
	local leaderstats = Instance.new("Folder")
	leaderstats.Parent = player
	leaderstats.Name = "leaderstats"

	local coins = Instance.new("IntValue")
	coins.Parent = leaderstats
	coins.Name = "Coins"

	local loadedstats = DataStore:GetAsync(player.UserId)

	if loadedstats ~= nil then
		coins.Value = loadedstats[1]
	else
		coins.Value = 100
	end
end

game.Players.PlayerAdded:Connect(loadleaderstats)

i just tried it rn and it does detect me, where do u have the script placed at?

I have the script in serverstorage

try placing it on serverscriptservice

wow im dumb i didnt put it in serverscriptstorage lmao

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.