I don't see what I did wrong,
Mr Output says :
Date - Players.Player.PlayerGui.Player:30: attempt to get length of local 'ThingsTouching' (a nil value)
Date - Players.Player.PlayerGui.Player, line 30 stack end
____________________________________
local Player = script.Parent.MF2:clone()
Player.Position = UDim2.new(0,100,0,0)
Player.Parent = script.Parent.Bricks
wait(5)
function GetPosition(Pos)
print("Start Search")
local list = {}
local c = script.Parent.Bricks:GetChildren()
for i = 1, #c do
-- O_O
local X1 = c[i].Position.X.Offset
local X2 = c[i].Position.X.Offset + c[i].Size.X.Offset
if Pos.X.Offset X2 then return end
local Z1 = c[i].Position.Z.Offset
local Z2 = c[i].Position.Z.Offset + c[i].Size.Z.Offset
if Pos.Z.Offset Z2 then return end
print("Found "..c[i].Name)
table.insert(list, c[i])
end
print("Number found: "..#list)
return list
end
while true do
-- Fall
local Height = Player.Position + UDim2.new(0,0,0,-20)
local ThingsTouching = GetPosition(Height)
if #ThingsTouching == 0 then
Player.Position = Player.Position - UDim2.new(0,0,0,5)
end
wait()
end |