Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Help with for loop not working?

Asked by 9 years ago

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.

0
You need a wait in your for loop. FearMeIAmLag 1161 — 9y
0
I have added a wait(1) but nothing happens, it dosent print either 1 nor 2 NinjoOnline 1146 — 9y

1 answer

Log in to vote
1
Answered by
adark 5487 Badge of Merit Moderation Voter Community Moderator
9 years ago

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

Ad

Answer this question