I'm trying to make a 3D footprint script but it doesn't seem to do anything. I've already sorted through all the errors I was getting and its not giving me any more. This script detects the distance between players and the surface then if a player is close enough subtracts their legs from the surface. Any help with it would be great.
-- tables -- local DetectDistance = {} local Char = {} local Surface = {} local x = {} local GlobalFreqency = 10 function GetCharacters() local Char = game.Workspace:GetChildren() for i=1,#Char do if not Char[i]:FindFirstChild("Humanoid") then table.remove(Char, i) end end end function GetSurface() local Surface = game.Workspace.ImprintableMap:GetChildren() for i=1,#Surface do for l=1,#Char do DetectDistance[l] = (Surface[i].position - Char[l].HumanoidRootPart.Position).magnitude end DueDistance = math.min(unpack(DetectDistance)) if DueDistance >= (Surface[i].Size.X + Surface[i].Size.Z)/2 + 5 then table.remove(Surface[i]) end end end while true do wait(1/GlobalFreqency) -- Get characters -- local Char = game.Workspace:GetChildren() for i=1,#Char do if not Char[i]:FindFirstChild("Humanoid") then table.remove(Char, i) end end -- Get Surfaces -- local Surface = game.Workspace.ImprintableMap:GetChildren() for i=1,#Surface do for l=1,#Char do DetectDistance[l] = (Surface[i].position - Char[l].HumanoidRootPart.Position).magnitude end DueDistance = math.min(unpack(DetectDistance)) if DueDistance >= (Surface[i].Size.X + Surface[i].Size.Z)/2 + 5 then table.remove(Surface[i]) end end -- Im guessing this part is broken -- if DetectDistance ~= nil and math.min(Surface.TriangleCount) <= 4980 then for i=1,#Char do for l=1,#Surface do x[1] = Char[i].LeftFoot:clone() x[1]:ClearAllChildren() x[1].name = "CharSub" .. i + l x[1].parent = game.Workspace.ImprintableMap x[2] = Char[i].LeftLowerLeg:clone() x[2]:ClearAllChildren() x[2].name = "CharSub" .. i + l + 1 x[2].parent = game.Workspace.ImprintableMap x[3] = Char[i].LeftUpperLeg:clone() x[3]:ClearAllChildren() x[3].name = "CharSub" .. i + l x[3].parent = game.Workspace.ImprintableMap x[4] = Char[i].RightFoot:clone() x[4]:ClearAllChildren() x[4].name = "CharSub" .. i + l x[4].parent = game.Workspace.ImprintableMap x[5] = Char[i].RightLowerLeg:clone() x[5]:ClearAllChildren() x[5].name = "CharSub" .. i + l + 1 x[5].parent = game.Workspace.ImprintableMap x[6] = Char[i].RightUpperLeg:clone() x[6]:ClearAllChildren() x[6].name = "CharSub" .. i + l x[6].parent = game.Workspace.ImprintableMap local Imprint = Surface[l]:SubtractAsync(x) Imprint.name = "SnowPlane" Imprint.parent = game.Workspace.ImprintableMap end end end end