The goal is that when a player presses e, they will move to the nearest grip point, and "climb" up a wall.
When the player presses their e key, this error occurs Players.Player1.Backpack.LocalScript:9: attempt to compare two userdata values
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local function FindNearestGrip()
local grips = game.Workspace:FindFirstChild("Grips", true):GetChildren()
table.sort(grips, function(a, b)
local dstA = (a.Position - player.Character.HumanoidRootPart.Position).magnitude
local dstB = (b.Position - player.Character.HumanoidRootPart.Position).magnitude
return a < b
end)
return grips[1]
end
mouse.KeyDown:connect(function(key)
if key == 'e' then
FindNearestGrip()
end
end)
