Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do i script and dropper and a furnace which works in a normal tycoon games?

Asked by 6 years ago

How do i make a dropper and furnace which works? I have been trying and trying but i can't seem to script it correctly.

0
Please post some of your code! (: Songist 49 — 6y
0
how do i link the photos? XviperIink 428 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

You actually have to show parts of your code, but because this is really easy I'll answer it as good as I can.

dropper code

dropper = script.Parent -- put this in the part that will drop the parts
TimeBetweenDrops = 2 -- time between drops

while wait(TimeBetweenDrops) do
    gold = Instance.new("Part")
    gold.Parent = workspace
    gold.Position = dropper.Position - Vector3.new(0,dropper.Size.Y,0) -- makes sure it spawns beneath the dropper
    gold.Anchored = false
    gold.CanCollide = true
    gold.Name = "Gold" -- name
end

Furnace code

furnace = script.Parent
money = 0 -- you can change this to a leaderstats value if you want, (or a global variable) it now prints your money everytime gold hits it)

furnace.Touched:connect(function(hit)
    if hit.Name == "Gold" then
        money = money + 1 -- if you need leaderstats, change this however you like
        print(money)
        hit:Destroy() -- destroys the part afterwards
    end
end)

Please mark this answer as best answer, I hope this solves the problems you had

0
This most likely won't work. Crazycat4360 115 — 6y
0
lol, I tested it, why wouldn't this work? User#20388 0 — 6y
Ad

Answer this question