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

[SOLVED] Workspace.Manage.RoomCheck:10: attempt to call global 'check' What's going on?

Asked by 5 years ago
Edited 5 years ago

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
0
is check even a thing? i never heard of it, mayb thats whats wrong and its probarly considering it nil thats why starmaq 1290 — 5y
0
Yea i just checked it gave me same error, that's cuz check() isnt a thing? what r u doing? starmaq 1290 — 5y
0
check is a function. Look down in the code. It starts at line 44 BenjySmb 16 — 5y
0
ohh sorry i thought it wasa lua function :facepalm: lol i suck sorry starmaq 1290 — 5y
View all comments (6 more)
0
this script is not working cuz youre assigning the function, or we can say creating it after it being called starmaq 1290 — 5y
0
move your function creation part of the script all the way to the top, and see if it works starmaq 1290 — 5y
0
for the script, check isnt a thing yet, remember that your computer reads the script line by line, you were calling the function before assigning it starmaq 1290 — 5y
0
fixed? starmaq 1290 — 5y
0
did i help? starmaq 1290 — 5y
0
rude.. starmaq 1290 — 5y

1 answer

Log in to vote
0
Answered by
clc02 553 Moderation Voter
5 years ago

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

Ad

Answer this question