[V1.1] Leaderstats Plus - Leaderstats have become unimaginably easier

Hiya !

I’m not 100% sure how to visually show you this module however I can give you some code snippets and examples on what it can do!

image

This module also supports strings, for whatever reason you use strings in a leaderstat!


Give 100 Cash when “Part” is touched

local lsp = require(game:GetService("ServerScriptService").LeaderstatsPlus)
local players = game:GetService("Players")

lsp:setDataValues({Cash = 0})
players.PlayerAdded:Connect(function(player) lsp(player) end)

game.Workspace.Part.Touched:Connect(function(hit: Part) 
    if hit.Parent:IsA("Model") and hit.Parent:FindFirstChild("Humanoid") then
        local character = hit.Parent
        local player = players:GetPlayerFromCharacter(character)
        local currentCash = player:GetAttribute("Cash")

        player:SetAttribute("Cash", currentCash + 100)
    end
end)

Give 100-200 cash every 3 seconds

local lsp = require(game:GetService("ServerScriptService").LeaderstatsPlus)
local players = game:GetService("Players")

lsp:setDataValues({Cash = 0})

players.PlayerAdded:Connect(function(player)
    lsp(player)

    coroutine.wrap(function()
        while true do
            local currentCash = player:GetAttribute("Cash")
            player:SetAttribute("Cash", currentCash + math.floor(math.random(100,200)))
            task.wait(3)
        end
    end)()
end)
2 Likes