How can I make a chance?

Hello I am making a rare occurance for a jumpscare to happen. The code I have right now makes it a 50/50 chance but I want to make it like a 10% for this special jumpscare to happen this is my code rn.

local jumpscare = math.random(1, 2)
	if jumpscare == 1 then
	game.SoundService.Ambience.Lose.shriek:Play()
	wait(.515)
	game.SoundService.Ambience.Lose.Explode:Play()
else
	
game.SoundService.Ambience.Lose.jumpscare:Play()
	
end

You could change
local jumpscare = math.random(1, 2)
to
local jumpscare = math.random(1, 10)

The arguments are to math.random are min,max. Therefore, just change your max to 10, and you should be set.

1 Like

omg I cant believe I didn’t think of this this is pretty basic stuff lol thanks!

2 Likes