so im wanting to use math.random to print a number onto a TextLabel when u click a brick, but ive got very very little Lua knowledge so idk how to do this :/ all i know how to do it print it to the output
So this is a 55x2 Dice roll Gambling system
This is its simple form, ill be making it a full GUI later but in simple form you Click the brick, it rolls math.random 1-100 if its 55 or higher it adds X to gold.....ive got the rolling and the 55+ adding to gold but i need the number that it rolls to show up in a TextLabel, which i dont know how to do
I tried
Dice.Text = Rolls
But i guess i dont know enough because it didnt work :/
heres my code :)
function onTouched(clicked)
part = clicked.Character.Head
local h = part.Parent:findFirstChild("Humanoid")
if (h~=nil) then
local thisplr = game.Players:findFirstChild(h.Parent.Name)
if (thisplr~=nil) then
local stats = thisplr:findFirstChild("leaderstats")
if (stats~=nil) then
local score = stats:findFirstChild("Gold")
if (score~=nil) then
local Dice = game.StarterGui.HUD.Roll -- This is the TextLabel
local Rolls = math.random(100)
for _ = 1, 1 do
print(Rolls)
if Rolls >= 55 then --This is being used as a 55x2 Gambling system
score.Value = score.Value + 1
end
wait(.1)
end
end
end
end
end
end
script.Parent.ClickDetector.MouseClick:connect(onTouched)

2 comments
math.Random = TextLabel.Text
Try changing the text in game then reseting, tell me if it appears