Dropper
Part 1
Model Script
local dropper = script.Parent
local dropZone = dropper.DropZone
while wait() do
if dropper.Running.Value then
wait(2)
local drop = Instance.new('Part')
drop.Position = dropZone.Position - Vector3.new(0,2,0)
drop.Size = Vector3.new(1,1,1)
drop.Parent = game.Workspace
end
end
Switch Script
local dropper = script.Parent.Parent
local switch = script.Parent
local click = switch.ClickDetector
click.MouseClick:Connect(function()
if dropper.Running.Value then
switch.BrickColor = BrickColor.new('Really red')
else
switch.BrickColor = BrickColor.new('Lime green')
end
dropper.Running.Value = not dropper.Running.Value
end)
Part 2
Leaderstats
local function onPlayerJoin(player)
local leaderstats = Instance.new('Folder')
leaderstats.Name = 'leaderstats'
leaderstats.Parent = player
local money = Instance.new('IntValue')
money.Name = 'Money'
money.Value = 0
money.Parent = leaderstats
end
game.Players.PlayerAdded:Connect(onPlayerJoin)
Switch Script
local dropper = script.Parent.Parent
local switch = script.Parent
local click = switch.ClickDetector
click.MouseClick:Connect(function(player)
dropper.Owner.Value = player.Name
if dropper.Running.Value then
switch.BrickColor = BrickColor.new('Really red')
else
switch.BrickColor = BrickColor.new('Lime green')
end
dropper.Running.Value = not dropper.Running.Value
end)
SellZone
local dropper = script.Parent.Parent
local sellZone = script.Parent
local function sell_drop(otherPart)
if otherPart.Name == 'Drop' then
otherPart:Destroy()
local owner = game.Players:FindFirstChild(dropper.Owner.Value)
if owner then
owner.leaderstats.Money.Value = owner.leaderstats.Money.Value + 1
end
end
end
sellZone.Touched:Connect(sell_drop)