Math.random Returning the same number

I want my script to create 4 random numbers to add/subtract from 4 values, but each instance of math.random returns the same number so the values all change to the same number making the all the same which I don’t want. I’ve tried putting math.randomseed(tick()) at the top of my script and it didnt change anything.

math.randomseed(tick())
local repstorage = game:GetService("ReplicatedStorage")
local cost1 = repstorage.Asset1Price
local cost2 = repstorage.Asset2Price
local cost3 = repstorage.Asset3Price
local cost4 = repstorage.Asset4Price
while true do
	wait(1)
	cost1.Value += math.random(-3,3)
	cost2.Value += math.random(-15,10)
	cost3.Value += math.random(-6,6)
	cost4.Value += math.random(-6,12)
end
1 Like

Nevermind, i rewrote the code and it started working, i still dont know exactly what fixed it but it works now.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.