I am trying to get some values, which works, make them a string and put them into a table, however this is not working:
function Move(Unit)
local PositionX = tonumber(Unit.Location.Value:sub(1,1))
print (PositionX)
local PositionZ = tonumber(Unit.Location.Value:sub(3,3))
local Adjacent = {}
local Position1 = string(PositionX..","..(tonumber(PositionZ) +1))
local Position2 = string(PositionX..","..tonumber(PositionZ) -1)
local Position3 = string(tonumber(PositionX) +1 ..","..PositionZ)
local Position4 = string(tonumber(PositionX) -1 ..","..PositionZ)
table.insert(Adjacent, Position1)
table.insert(Adjacent, Position2)
table.insert(Adjacent, Position3)
table.insert(Adjacent, Position4)
for i=1, 4 do
game.Workspace.Plates[Adjacent[i]].Material = "Neon"
end
end
Error: 14:56:08.739 - Workspace.Script:6: attempt to call global 'string' (a table value)

5 comments
nob
nob [2]
:(
I wasn't "making up a function an expecting it to work", string came up in a special font colour so I presumed it was an in-built function.
Right, but you didn't know what it did, so just look that stuff up in the future. Also, it's rather annoying to accept the answer that came 3 hours later, gave the same advice, but didn't include a code snippet...