Dropper (3-4)
New Dropper Script
local buy = script.Parent
local ReplicatedStorage = game:GetService('ReplicatedStorage')
local canBuy = true
local sellPrice = 25
local function buy_dropper(otherPart)
local player = game.Players:GetPlayerFromCharacter(otherPart.Parent)
local playerMoney = player.leaderstats.Money
if player and playerMoney.Value > sellPrice and canBuy then
canBuy = false
playerMoney.Value = playerMoney.Value - sellPrice
local Dropper = ReplicatedStorage:FindFirstChild('Dropper')
Dropper.Sell.Value = sellPrice/5
local newDropper = Dropper:Clone()
newDropper.Parent = game.Workspace
newDropper:SetPrimaryPartCFrame(buy.CFrame + Vector3.new(0,6,0))
newDropper.Name = player.Name
buy:Destroy()
end
end
buy.Touched:Connect(buy_dropper)
Sell Zone Script
local dropper = script.Parent.Parent
local sellZone = script.Parent
local sellAmount = dropper.Sell.Value
local function sell_drop(otherPart)
if otherPart.Name == 'Drop' then
otherPart:Destroy()
local owner = game.Players:FindFirstChild(dropper.Name)
if owner then
owner.leaderstats.Money.Value = owner.leaderstats.Money.Value + sellAmount
end
end
end
sellZone.Touched:Connect(sell_drop)
Switch Script
local dropper = script.Parent.Parent
local switch = script.Parent
local click = switch.ClickDetector
click.MouseClick:Connect(function(player)
if player.Name == dropper.Name then
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
end)