The problem is it gets stuck on the repeat meaning the until condition isn't being met. There is multiple topics in the data.Topics table.
math.randomseed(os.time()) math.random() math.random() math.random()
function m.ChooseTopic(oldtopic)
local topic
if oldtopic then
repeat
wait()
topic = data.Topics[math.random(1, #data.Topics)]
until not topic == oldtopic
else
topic = data.Topics[math.random(1, #data.Topics)]
end
return topic --script doesn't get this far
end
How can I make math.random be random?

3 comments
Where is your connection line?
It's being fired in a different spot, I can assure you though that that is not the problem :/
"not" can usually be used in place of ~= But the problem is the not operator has higher precedence than all operators other than ^. So you need to use parentheses to fix this.