Hello, developers. I thought I would never make a thread about this, but here I am.
I am making a game and cash has a 2/3 chance of disappearing before the game starts. However, the math.random number is always the same.
What happens is all the money disappears or none of it gets destroyed.
I have tried putting the math.random inside of a function and outside of it too. I’ve even tried math.randomseed, but nothing works
Code:
function Check()
math.randomseed(os.time())
local Number = math.random(1, 3)
if Number == 1 or Number == 2 then
script.Parent.Parent:Destroy()
end
end
function onTrigger(Player)
local N = math.random(50, 100)
script.Parent.MaxActivationDistance = 0
script.Parent.Parent.Transparency = 1
Player.leaderstats.Money.Value += N
game:GetService("ReplicatedStorage").SendNotification:FireClient(Player, "Money Found", "You found $"..N, 5)
task.wait(180)
script.Parent.MaxActivationDistance = 8
script.Parent.Parent.Transparency = 0
end
Check()
script.Parent.Triggered:Connect(onTrigger)
I am really confused.