Taller Lua

Catálogo/Leaderstats y monedas

EconomíaFácil

Leaderstats y monedas

Crea leaderstats al entrar: Monedas y Nivel. Base de cualquier simulador, obby o tycoon.

Valores

Dónde va

  1. 01

    ServerScriptService

    Inserta un Script y pega el código.

  2. 02

    Play

    Arriba a la derecha verás Monedas y Nivel.

Explorer → ServerScriptServiceScriptLeaderstats

Leaderstats.luaScript
--[[
  Leaderstats y monedas · Taller Lua
  Pega este Script en ServerScriptService y pulsa Play.
  Es para TU juego en Roblox Studio — no es un exploit.
]]

local Players = game:GetService("Players")

local STARTING_COINS = 0
local STARTING_LEVEL = 1

local function setup(player)
	if player:FindFirstChild("leaderstats") then
		return
	end
	local stats = Instance.new("Folder")
	stats.Name = "leaderstats"
	stats.Parent = player

	local coins = Instance.new("IntValue")
	coins.Name = "Monedas"
	coins.Value = STARTING_COINS
	coins.Parent = stats

	local nivel = Instance.new("IntValue")
	nivel.Name = "Nivel"
	nivel.Value = STARTING_LEVEL
	nivel.Parent = stats
end

Players.PlayerAdded:Connect(setup)
for _, player in ipairs(Players:GetPlayers()) do
	setup(player)
end