After 5 weeks of scripting, This is as much as I can remember in terms of creating leaderstas. Are their any ways to make this better?
--//getServices
local player = game:GetService("Players")
---------------------------------------------------------------------------------------
--//leaderstatsFunction
player.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
---------------------------------------------------------------------------------------
--//Adding a "Stage" count to the leaderstats
local Stage = Instance.new("IntValue")
Stage.Name = "Stage"
Stage.Value = 0
Stage.Parent = leaderstats
---------------------------------------------------------------------------------------
local XP = Instance.new("IntValue")
XP.Name = "XP"
XP.Value = 0
XP.Parent = leaderstats
---------------------------------------------------------------------------------------
--//Connects the MinV & MaxV to the Currency using an intValue.
local MinV = game.ReplicatedStorage.CurrencyValue:GetAttribute("MinV")
local MaxV = game.ReplicatedStorage.CurrencyValue:GetAttribute("MaxV")
local Currency = Instance.new("IntValue")
Currency.Name = "Coins"
Currency.Value = MinV
Currency.Parent = leaderstats
Currency.Changed:Connect(function()
Currency.Value = math.clamp(Currency.Value, MinV, MaxV)
end)
end)