I don't understand why I am getting this warning, my leaderstats folder is in the player.
1 | game.Players.PlayerAdded:connect( function (player) |
2 | local nextstage = workspace:WaitForChild( "Stage" ..(player.leaderstats.Stage.Value+ 1 )) |
3 | local stage = workspace:WaitForChild(player.leaderstats.Stage.Value) |
4 | wait() |
5 | nextstage.BrickColor = BrickColor.new( "Shamrock" ) |
6 | end ) |
How are you creating the leaderstats folder? If you're creating it through scripts it should be
1 | game.Players.PlayerAdded:Connect( function (player) |
2 | local leaderstats = Instance.new( "Folder" ) |
3 | leaderstats.Name = "leaderstats" |
4 | leaderstats.Parent = player |
5 | end ) |
in a Script in ServerScriptService. What this does is creates a folder in the player ever time a player joins.
You don't need the player's character for this script to work so it should be like this:
1 | game.Players.PlayerAdded:Connect( function (player) |
2 | local leaderstats = player:WaitForChild( "leaderstats" ) |
3 | local stage = leaderstats:WaitForChild( "Stage" ) |
4 | local value = stage.Value |
5 | local nextstage = workspace:WaitForChild( "Stage" ..player.leaderstats.Stage.Value + 1 ) |
6 |
7 | wait() |
8 | nextstage.BrickColor = BrickColor.new( "Shamrock" ) |
9 | end ) |