leaderstats script roblox code example

Example 1: how to make a leaderstats script

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)

Example 2: leaderstat script

--Roblox--
--Function Script--

function play()
   game.Part1.Transparency = 1 --Change Part1 to your part
end

Tags:

Misc Example