Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 5 years ago
Edited 5 years ago

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

Log in to vote
0
Answered by 5 years ago

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)
0
I don't understand whats different from this script and the original? sbob12345m 59 — 5y
Ad

Answer this question