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

Why won't my players get there leaderstats folder when they join the game?

Before, I used to have just one sword for everyone to use when they played in a match. But, recently I added more swords which players can purchase to upgrade. It seems like ever since I added that new feature my game has been failing a ton. Some players won't spawn in the match, some players don't even have a sword in the match, and others don't have leader stats for money!

I created a short video of my problems and the scripts which received the error message:

http://drive.google.com/file/d/1rA_i4K32Wd7OAZPcv9uLMcS0S3h-CdeI/view?usp=sharing

Why won't my players get there leader stats folder and their swords when they join the game?

BTW I am new to scripting so thanks!

If you think the problem is something else, and let me know.

1 answer

Leaderstats has to be created by the server and placed into the player. When the player joins, YOU MUST use the server to CREATE the leaderstats.

game.Players.PlayerAdded:Connect(function(player)
	local ls = Instance.new("Folder")
	ls.Name = "leaderstats"
	ls.Parent = player
	local lsvalue = Instance.new("IntValue") -- Different value types can be used.
	lsvalue.Name = "Kills"
	lsvalue.Value = 1 -- IntValue requires a number. Use a string to enter text.
	lsvalue.Parent = ls
end)

1 comment

0

I don't understand whats different from this script and the original?

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