Advertisement
axefec

Untitled

Sep 5th, 2022
13
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | Gaming | 0 0
  1. local inputservice = game:GetService("UserInputService")
  2.  
  3. inputservice.InputBegan:connect(function(i,g)
  4.  
  5. if i.UserInputType == Enum.UserInputType.Keyboard then
  6.  
  7. if i.KeyCode == Enum.KeyCode.E then
  8.  
  9. for _,Door in pairs(workspace.Doors:GetChildren()) do
  10.  
  11. local Mag = (Door.Center.Position-game.Players.LocalPlayer.Character.HumanoidRootPart.Position).magnitude
  12.  
  13. if Mag <= Door.Range.Value then
  14.  
  15. Door.Event:FireServer()
  16.  
  17. break
  18.  
  19. end
  20.  
  21. end
  22.  
  23. end
  24.  
  25. end
  26.  
  27. end)
  28.  
  29. while true do
  30.  
  31. script.Parent.ImageLabel.Visible = false
  32.  
  33. for _,Door in pairs(workspace.Doors:GetChildren()) do
  34.  
  35. local Mag = (Door.Center.Position-game.Players.LocalPlayer.Character.HumanoidRootPart.Position).magnitude
  36.  
  37. if Mag <= Door.Range.Value then
  38.  
  39. local D3ToD2 = workspace.CurrentCamera:WorldToScreenPoint(Door.Center.Position)
  40.  
  41. script.Parent.ImageLabel.Visible = true
  42.  
  43. script.Parent.ImageLabel.Position = UDim2.new(0,D3ToD2.X,0,D3ToD2.Y,0)
  44.  
  45. break
  46.  
  47. end
  48.  
  49. end
  50.  
  51. wait()
  52.  
  53. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement