Dialog not randomizing

So basically my code makes it so once you go up to an npc they say something through the dialog feature that is a child to the head.

Dialog = script.Parent.Dialog
DialogWords = {"What's up?", "What up man!", "Ready to buy some weapons?", "From axes to sickles we have it all!", "Welcome aboard!", "Nice to see you!"}

while true do
	Dialog.InitialPrompt = DialogWords[math.random(#DialogWords)]
end

Now the code works but one problem that once it chooses a word, It will repeat that word and not pick another one.

I’ve tried to fix it but nobody is really making the same thing as me.

Thanks all!

Dialog = script.Parent.Dialog
DialogWords = {"What's up?", "What up man!", "Ready to buy some weapons?", "From axes to sickles we have it all!", "Welcome aboard!", "Nice to see you!"}

while true do
for i = 1,#DialogWords do
Dialog.InitialPrompt = DialogWords[math.random(i)]
end
wait(0.5)
end
3 Likes