Creating PlayerStats in ServerStorage occasionally failing

Hi! I am storing my player stats in ServerStorage, but sometimes the new Instance fails, although the Folder I store them in is there.


	local plrStats ="NumberValue")
	plrStats.Name = player.Name
	plrStats.Parent = ServerStorage.PlayerMoney --PlayerMoney is the Folder 
	local isOwner ="ObjectValue")
	isOwner.Name = "OwnsTycoon"
	isOwner.Parent = plrStats

I’ve run multiple playtests. I cannot understand why sometimes they load and sometimes not.


isn’t player stats supposed to be a folder am i right?

is this a leaderstats or no? because if so im pretty sure they can only be made in ServerScriptService

and as he said, yes there should be a folder above

local plrStats ="NumberValue")

It isn’t leaderstats. It’s just a storage for the money value. The actual leaderstats is a separate script that uses a StringValue. I passed the value through a BindableEvent. Don’t want to store the player money on the client.

I would suggest storing data like this in a module script because it is more reliable and may be more efficient because the server doesn’t have to create an entire instance.

Can you point me to a post or docs page that demonstrates ModuleScript data storing?

it handles it ever so slightly different in studio than in-game, out of personal experience i can tell you from personal experience that it should work completely fine in an actual game

1 Like

You’re right! Appreciate the heads up.