I'm working on the function where block that you're closest to and it win.
LocalScript
local runService = game:GetService("RunService")
local inputs = game:GetService("UserInputService")
local player = game:GetService("Players").LocalPlayer
local doorfolder = workspace.DoorModels
local player = game:GetService("Players").LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local humanoid = char:WaitForChild("Humanoid")
local root = char:WaitForChild("HumanoidRootPart")
inputs.InputBegan:Connect(function(input, process)
local isMoreThan2 = false
if input.KeyCode == Enum.KeyCode.E then
if IsInside == true then
local distanceinfo : {number} = {}
for i, v in pairs(information) do
if v.Bool == true and cooldown then
local tance = (v.Block.Position - root.Position).magnitude
table.insert(distanceinfo, tance)
end
end
if #distanceinfo == 2 or #distanceinfo >= 2 then
print(distanceinfo)
print(true)
else
print(distanceinfo)
print("false")
end
end
end
end)
