i dont know why this math.value isnt working, i want that when i click, will choose a random number between 1 and 6, but dont work
function onClicked() if script.Parent.Parent.Parent.Parent.stats.BornZone.Value == "None" then script.Parent.Parent.Parent.Parent.stats.BornZone.Value = math.random(1,2,3,4,5,6) end script.Parent.MouseButton1Click:connect(onClicked)
Like @WoolHat said, math.random
uses two numbers and then chooses one in between, but the math.random
generator will always have a certain order unless you use math.randomseed
. math.randomseed gives the generator a random 'seed' therefore, the number will always be different.
math.randomseed(tick()) function onClicked() if script.Parent.Parent.Parent.Parent.stats.BornZone.Value == "None" then script.Parent.Parent.Parent.Parent.stats.BornZone.Value = math.random(1,6) end script.Parent.MouseButton1Click:connect(onClicked)
Hope this helps!