My script spits out Workspace.Manage.RoomCheck:10: attempt to call global 'check' (a nil value) What's going on?
Here's my code
-- Room Checker Script local boardRooms = game.Workspace.Manage.SurfaceGui.Rooms local roomDbase = game.ReplicatedStorage.RoomDatabase.Standard Ok = Color3.new(0, 184, 6) Ta = Color3.new(184,0,0) repeat wait(15) -- Normal Rooms check("101") check("102") check("103") check("104") check("105") check("106") check("201") check("202") check("203") check("204") check("205") check("206") check("301") check("302") check("303") check("304") check("305") check("306") wait(1) -- Suite Rooms check("207S") check("208S") check("209S") check("210S") check("307S") check("308S") check("309S") check("310S") check("400S") wait(1) until script.Parent == nil function check(roomId) if roomDbase[roomId].Owner.Value ~= "" then boardRooms[roomId].BackgroundColor3 = Ta boardRooms[roomId].N1.Text = roomDbase[roomId].Owner.Value print("Room "..roomId.." assigned to board.") end if roomDbase[roomId].Owner.Value == "" then boardRooms[roomId].BackgroundColor3 = Ok boardRooms[roomId].N1.Text = "Available" print("Room "..roomId.." cleared from board.") end end
You probably figured it out, but if you don't want to put the function in a certain order you can also put at the top of script
local check
So long as you finish defining it before you end up calling it. You can do that with your script by enclosing the lines 2 to 41 in a function and calling that function as the very last line of the script