How to fix my leaderstats

I have a leaderstat folder and this script is support to make Power. What is wrong. will not make put Power in to leaderstats

game.Players.PlayerAdded:Connect(function(player)

	local leaderstats = player:FindFirstChild("leaderstats")
	
		local power = Instance.new("IntValue")
		power.Name = "Power" -- currency's name
		power.Value = 0 -- cash value
		power.Parent = leaderstats

end)
1 Like

The player doesn’t have a folder named “leaderstats” in them when they join, you have to use Instance.new to create the folder instead

oh wait maybe not

yea im pretty sure the player doesn’t have a leaderstats folder on join

1 Like

there is a script that makes one when joined.

1 Like

question: what exactly happens when you run the script?

Anyways, I’d assume the issue is that leaderstats isn’t being created fast enough. Try using WaitForChild instead

1 Like

Great!! I tried the WaitForChilde instead. It worked! thank you!!!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.