I'm trying to finish a script.
but I am having a few problems, I can not fix it.
I do not know why it appears this error!
can someone help me?
I created the script for the player only have a house, if the player into another house ,the old house will be zero for all(Free)
--Thank for reading--

error :
1
attempt to index field '?' (a nil value)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
house = {} function create(name) return function (area) return function (triggers) return function (button_name) house[name] = { areaStartX = area[1], areaStartY = area[2], areaEndX = area[3], areaEndY = area[4], triggers = triggers, button = button_name, -- USGN owner owner = 0, } end end end end function Exists(name) return house[name] ~= nil end function Check_point(x,y) for name, check in pairs(house) do if x >= check.areaStartX and y >= check.areaStartY and x <= check.areaEndX and y <= check.areaEndY then return name end end end
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
addhook("use","Use_") function Use_(id,event,data,x,y) local usgn = player(id, "usgn") local house_name = Check_point(x,y) local name = {} for k,v in pairs(house) do name = v[k] end local e = entity(x,y,"name") local b = ""..house[house_name].button.."" if Exists(house_name) then if e == b then if house[name].owner == usgn then house[name].owner = 0 parse("trigger "..house[name].button) parse("sv_msg ©255000255"..name.." is free now") house[house_name].owner = usgn parse("trigger "..house[house_name].button) parse("sv_msg ©255000255"..player(id,"name").." is owner of 2 "..name) elseif house[house_name].owner ~= usgn then house[house_name].owner = usgn parse("sv_msg ©255000255"..name) parse("sv_msg ©255000255"..player(id,"name").." is owner of "..house_name) parse("trigger "..house[house_name].button) end end end end