Hey, I was wondering, how could I use math.clamp inside of a leaderstats script here’s what I had an idea of using
game.Players.PlayerAdded:Connect(function(player)
local leader = Instance.new(“Folder”)
leader.Name = “leaderstats”
leader.Parent = player
local coins = Instance.new(“NumberValue”)
coins.Name = “Coins”
coins.Parent = leader
local space = Instance.new(“NumberValue”)
space.Name = “Space”
space.Parent = player
coins.Changed:Connect(function()
local max = space
if coins > max then
coins = math.clamp(coins.Value, 0, space.Value)
Would this script work if I tried it?
