Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why is Player Added not working at all?

I know theres a bug with player added and it is buggy in play solo but even when i play the published version it doesn't even print 'Player Added'. I know theres no problems with the variables but can somebody please help?

-- Scripted by ThePhantomDeveloper

local dataStoreService = game:GetService('DataStoreService')
local characterCustimisationDataStore = dataStoreService:GetDataStore('CharacterCustimisationDataStore')

local characterCheck = game.ReplicatedStorage:WaitForChild('CharacterCheck')

game.Players.PlayerAdded:connect(function(player)
	print('Player Added')
	player.CharacterAdded:connect(function(character)
		print('Character Added')
		local hasFinishedCustimisation = characterCustimisationDataStore:GetAsync(tostring(player.UserId) .. 'HasFinishedCustimisation') or false
		if not hasFinishedCustimisation then
			print('Firing')
			characterCheck:FireClient(player)
		end
	end)
end)

1 comment

0

It does get past the :WaitForChild() if your wondering.

1 answer

✓ Accepted answer

It is always better to test everything in server-mode, as solo play lacks some features. Server-mode is what the game will look like after publishing it.

But if you insist, here's a piece of code that can help you.

for _,player in pairs(Players:GetPlayers()) do
     onPlayerAdded(player)
end
-- Putting this at the end of your script should help resolve the problem,
-- as solo mode is loaded faster than scripts.

3 comments

0

I tried server mode aswell and that didn't work, I even tried the published version.

0

I've tested your code.. It works fine for me.

0

Oh,anwer accepted nevermind

This discussion is preserved as it was. New answers, comments, and votes are closed.