So. I was trying to make this thing when you press the key, E on your keyboard. The door tweens. But it doesn't show anything in the output. Here is the code, this code is written in a regular script, not a local script, not a module script.
local UIS = game:GetService("UserInputService")
local MaxDistance = 5
UIS.InputBegan:Connect(function(input, player)
if input.KeyCode == Enum.KeyCode.E then
local HumanoidRootPart = player.Character.HumanoidRootPart
local MainPart = game.Workspace.MainPart
local TweenService = game:GetService("TweenService")
if HumanoidRootPart.Position - MainPart.Position.Magnitude <= MaxDistance then
local TweenInformation = TweenInfo.new(
3,
Enum.EasingStyle.Sine,
Enum.EasingDirection.Out,
0,
true,
1
)
local Properties = {
Size = Vector3.new(6.27, 0.05, 2);
}
local Tween = TweenService:Create(MainPart,TweenInformation,Properties)
Tween:Play()
end
end
end)

2 comments
"if HumanoidRootPart.Position - MainPart.Position.Magnitude <= MaxDistance then" -> "if (HumanoidRootPart.Position - MainPart.Position).Magnitude <= MaxDistance then"
Another error is your player. The 2nd argument of InputBegan:Connect is not player, is gameProcessed.