Hello there, I tried to make a TextLabel where the text constantly changes it's number with the math.random script, which I obviously used the while loop to make it constantly change without stopping, however it doesn't seem to work, the TextLabel's Text isn't changing at all, how do I fix it?
SCRIPT:
local user = game:GetService("Players").LocalPlayer
local indiUI = user.PlayerGui.Roll.TextLabel
local what = game.Workspace.lobbySpawn
what.Touched:Connect(function()
while true do
wait()
local numbers = math.random(1, 6)
if numbers == 1 then
indiUI.Text = "1"
elseif numbers == 2 then
indiUI.Text = "2"
elseif numbers == 3 then
indiUI.Text = "3"
elseif numbers == 4 then
indiUI.Text = "4"
elseif numbers == 5 then
indiUI.Text = "5"
elseif numbers == 6 then
indiUI.Text = "6"
end
end
end)

1 comment
If you want this to happen when lobbySpawn is touched just tell me! There is an easy way to do it.