I am trying to make a game where it spawns an item at a specific time like in the game shindo life. I have already made the time, but I have no idea how to make an item spawn at that time. Thanks.
COMMUNITY QUESTION
How do I make rarity spawn chance?
1 answer
This consists of math.random which generates a random number, aka chances of the item spawning. https://developer.roblox.com/en-us/api-reference/lua-docs/math
Make sure you have your item in Replicated storage
local time = 5 -- change time
local item = game.ReplicatedStorage.Part
local function spawnitem()
local spawning = item:Clone()
spawning.Parent = game.Workspace
end
while wait(time) do
local chance = math.random(1,2) -- 50% chance
if chance == 1 then spawnitem()
print(chance)
end
end
This discussion is preserved as it was. New answers, comments, and votes are closed.

3 comments
for a 50% chance, you would want to choose between two numbers, so you would do math.random(1, 2)
for a 50% chance, you would want to choose between two numbers, so you would do math.random(1, 2)
typo mb