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

How to make a Object Spawner? [closed]

Asked by 4 years ago

i want to know how to make a item spawner every so long Ex: star drops ever 180 seconds and despawns 50 seconds later

Closed as Not Constructive by DeceptiveCaster

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

1 answer

Log in to vote
0
Answered by
Elixcore 1337 Moderation Voter
4 years ago
Edited 4 years ago

You can achieve this by using Debris and Instance.new() or cloning it and wrapping it inside a while loop.

local star = game:GetService('ServerStorage').Star -- location of star.

--Cloning item:

while wait(180) do
    local clone = star:Clone()
    clone.Parent = workspace
-- Despawning:
    game.Debris:AddItem(clone, 50) 
end
Ad