✓ Accepted answer
Maybe, if you think like the most beginners, you will think on a script like this
local rand = math.random(1,3)
wait(2)
if script.Parent.Visible == true then
if rand == 1 then
script.Parent.Text = script.Parent.Fact1.Value
wait(6)
elseif rand == 2 then
script.Parent.Text = script.Parent.Fact2.Value
wait(6)
elseif rand == 3 then
script.Parent.Text = script.Parent.Tip1.Value
wait(6)
end
end
Obvoiusly, this is too long. Maybe you should use a table. You can consider it as a value container:
local myFirstTable = {nil, false, "dav1000999", 563754, math.huge, nil, "efl"}
So, you can use it to shorten your script. Once the three results use the same structure, we can replace them.
local values = {"Fact1", "Fact2", "Tip1"}
local num = math.random (1,3)
if script.Parent.Visible == true then
script.Parent.Text = script.Parent:WaitForChild(values[num]).Value
wait(6)
end
Hope it helps!
2 comments
It did thanks. :D
please be sure to accept answer