Taller Lua

Catálogo/Dropper de tycoon

KitsMedio

Dropper de tycoon

Un dropper suelta piezas cada pocos segundos. Si caen al colector, suman monedas al jugador más cercano.

Valores

Dónde va

  1. 01

    Leaderstats

    Instala Monedas antes.

  2. 02

    Script

    Pega en ServerScriptService. Dropper y colector aparecen juntos.

Explorer → ServerScriptServiceScriptDropper

Dropper.luaScript
--[[
  Dropper de tycoon · 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 Debris = game:GetService("Debris")

local INTERVAL = 2
local VALUE = 1

local old = workspace:FindFirstChild("TallerTycoon")
if old then
	old:Destroy()
end

local folder = Instance.new("Folder")
folder.Name = "TallerTycoon"
folder.Parent = workspace

local function part(name, size, cframe, color)
	local p = Instance.new("Part")
	p.Name = name
	p.Anchored = true
	p.Size = size
	p.CFrame = cframe
	p.Color = color
	p.Parent = folder
	return p
end

part("Base", Vector3.new(16, 1, 16), CFrame.new(20, 5, 20), Color3.fromRGB(58, 62, 70))
local spout = part("Dropper", Vector3.new(4, 2, 4), CFrame.new(20, 14, 20), Color3.fromRGB(120, 128, 140))
local collector = part("Colector", Vector3.new(10, 1, 10), CFrame.new(20, 5.6, 20), Color3.fromRGB(90, 150, 110))

local function nearestPlayer(position)
	local best, bestDist
	for _, player in ipairs(Players:GetPlayers()) do
		local hrp = player.Character and player.Character:FindFirstChild("HumanoidRootPart")
		if hrp then
			local dist = (hrp.Position - position).Magnitude
			if dist < 40 and (not bestDist or dist < bestDist) then
				best = player
				bestDist = dist
			end
		end
	end
	return best
end

collector.Touched:Connect(function(hit)
	if hit.Name ~= "Drop" then
		return
	end
	local player = nearestPlayer(collector.Position)
	hit:Destroy()
	if not player then
		return
	end
	local stats = player:FindFirstChild("leaderstats")
	local coins = stats and stats:FindFirstChild("Monedas")
	if coins then
		coins.Value += VALUE
	end
end)

task.spawn(function()
	while spout.Parent do
		local drop = Instance.new("Part")
		drop.Name = "Drop"
		drop.Size = Vector3.new(1.4, 1.4, 1.4)
		drop.Color = Color3.fromRGB(210, 196, 130)
		drop.Position = spout.Position - Vector3.new(0, 3, 0)
		drop.Parent = folder
		Debris:AddItem(drop, 12)
		task.wait(INTERVAL)
	end
end)