This is my code
I had to change the while true do loop to renderstepped now the ImageLabel Won't become invisible
local inputservice = game:GetService("UserInputService")
inputservice.InputBegan:Connect(function(i,g)
if i.UserInputType == Enum.UserInputType.Keyboard then
if i.KeyCode == Enum.KeyCode.E then
for _,Door in pairs(workspace.Doors:GetChildren()) do
game:GetService("ReplicatedStorage").DoorToggle:FireServer()
break
end
end
end
end)
game:GetService("RunService").RenderStepped:Connect(function()
for _,Door in pairs(workspace.Doors:GetChildren()) do
local Mag = (Door.Center.Position-game.Players.LocalPlayer.Character:WaitForChild("HumanoidRootPart").Position).magnitude
if Mag <= Door.Range.Value then
local D3ToD2 = workspace.CurrentCamera:WorldToScreenPoint(Door.Center.Position)
script.Parent.ImageLabel.Visible = true
script.Parent.ImageLabel.Position = UDim2.new(0,D3ToD2.X,0,D3ToD2.Y,0)
break
end
end
wait()
end)
