You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
i want to make a working random words generator
What is the issue? Include screenshots / videos if possible!
i made a random words generator and it keep printing same words
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
i searched it on devforum and i cant find solution
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
-- local words = {
"words",
"pig",
}
local words2 = math.random(#words)
local random = words[words2]
while true do
wait(1)
print(random)
end
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.
local words = {
"words",
"pig",
}
while true do
local words2 = math.random(#words)
local random = words[words2]
table.remove(words, words2)
wait(1)
print(random)
end
That is because you are removing values from the table so the table would be empty after 2 runs so if you want to keep the value then create a variable that stores the old word,
here is how you do it:
local words = {
"words",
"pig",
}
local Oldword
while true do
repeat words2 = math.random(1,#words) until words2 ~= Oldword
local random = words[words2]
Oldword = random
wait(1)
print(random)
end
local words = {
"words",
"pig",
}
while true do
local words2 = math.random(#words)
local randomwords = words[words2]
table.remove(words, words2)
wait(1)
if randomwords ~= nil then
print("Random words : "..randomwords, attemps.Value.."attemps")
end
end