Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Help with for loop not working?

Inside ServerScriptStorage

local ods = game:GetService("DataStoreService"):GetOrderedDataStore("Score")

function updateBoard(board, data)
	for i,v in pairs(data) do
		wait(1)
		print("1")
		local pos = i
		local name = v.key
		local score = v.value
		local dispname = board:findFirstChild("Name"..pos)
		local dispval = board:findFirstChild("Score"..pos)
		dispname.Text = tostring(name)
		dispval.Text = tostring(score)
		print("2")
	end	
end

Dosent print 1 or 2. Please help.

2 comments

0

You need a wait in your for loop.

0

I have added a wait(1) but nothing happens, it dosent print either 1 nor 2

1 answer

✓ Accepted answer

Assuming this is your entire code, updateBoard is never called, so of course it doesn't run.

This discussion is preserved as it was. New answers, comments, and votes are closed.