Check out example codes for "how to make a leaderstats script". It will help you in understanding the concepts better.

Code Example 1

function onPlayerEntered(newPlayer)
	wait(.5)
	local stats = Instance.new("IntValue")
	stats.Name = "leaderstats"

	local score = Instance.new("IntValue")
	
	score.Name = "Cash" -- Change "Cash" with Your Leaderstats Name
	score.Value = 0

	score.Parent = stats	
	stats.Parent = newPlayer
end

game.Players.ChildAdded:connect(onPlayerEntered)
--Made By Rigby#9052 on Discord

Learn ReactJs, React Native from akashmittal.com