How to make a script select a random number between to numbers

Hi
im making a game and I want to know how do I make a script that randomly selects a number between something like 10 and 50 every time a button is pressed, and then the number is placed in a numberValue

I know how to make most of the script but how do I make a math.random that every time you press a button it randomlt picks?

If it’s a UI button then

script.Parent.MouseButton1Click:Connect(function()
    local RandomNumber = math.random(10,50)
    YourNumberValue.Value = RandomNumber
end)
2 Likes