Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I make rarity spawn chance?

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.

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

3 comments

0

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

0

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

0

typo mb

This discussion is preserved as it was. New answers, comments, and votes are closed.