TheUnknownDiscord

collide??

Dec 14th, 2021 (edited)
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.88 KB | None | 0 0
  1. part1 = Instance.new("Part", script)
  2. part1.Size = Vector3.new(10,10,1)
  3. part1.Anchored = true
  4. part1.CFrame = owner.Character.HumanoidRootPart.CFrame
  5. local result = workspace:Raycast(owner.Character.HumanoidRootPart.Position + owner.Character.HumanoidRootPart.CFrame.upVector * 2.125,owner.Character.HumanoidRootPart.CFrame.upVector * -500)
  6. if result then
  7. part1.Position = result.Position
  8. end
  9. local screengui = Instance.new("SurfaceGui", part1)
  10. screengui.Name = "Textlol2"
  11. screengui.Face = Enum.NormalId.Front
  12. Gui2 = Instance.new("Frame",screengui)
  13. Gui2.BackgroundColor3 = BrickColor.new("Really black").Color
  14. Gui2.Size = UDim2.new(0.75, 0, 0.75, 0)
  15. Gui2.BorderColor3 = BrickColor.new("Institutional white").Color
  16. Gui2.BorderSizePixel = 5
  17. Gui1 = Instance.new("Frame",screengui)
  18. Gui1.BackgroundColor3 = Color3.fromRGB(255,0,0)
  19. Gui1.Size = UDim2.new(0.0625, 0, 0.0625, 0)
  20. local object = Instance.new("ObjectValue", owner.PlayerGui)
  21. object.Value = Gui1
  22. object.Name = 'BLOCK'
  23. local object2 = Instance.new("ObjectValue", owner.PlayerGui)
  24. object2.Value = Gui2
  25. object2.Name = 'BLOCK2'
  26. Gui2.AnchorPoint = Vector2.new(0.5, 0.5)
  27. Gui2.Position = UDim2.new(0.5, 0, 0.5, 0)
  28. Gui1.AnchorPoint = Vector2.new(0.5, 0.5)
  29. Gui1.Position = UDim2.new(0.5, 0, 0.5, 0)
  30. local mr = Instance.new("RemoteEvent",part1)
  31. local object3 = Instance.new("ObjectValue", owner.PlayerGui)
  32. object3.Value = mr
  33. object3.Name = 'REMOTE'
  34. NLS([[
  35. local mouse = owner:GetMouse()
  36. local uis = game:GetService("UserInputService")
  37. local block = owner.PlayerGui.BLOCK.Value
  38. local block2 = owner.PlayerGui.BLOCK2.Value
  39. local remote = owner.PlayerGui.REMOTE.Value
  40. wait()
  41. coroutine.wrap(function()
  42. game:GetService("RunService").RenderStepped:Connect(function()
  43. if uis:IsKeyDown(Enum.KeyCode.T) then
  44. remote:FireServer(block.Position + UDim2.new(0,0,0,-0.035))
  45. wait(0.075)
  46. elseif uis:IsKeyDown(Enum.KeyCode.G) then
  47. remote:FireServer(block.Position + UDim2.new(0,0,0,0.035))
  48. wait(0.075)
  49. elseif uis:IsKeyDown(Enum.KeyCode.F) then
  50. remote:FireServer(block.Position + UDim2.new(0,-0.035,0,0))
  51. wait(0.075)
  52. elseif uis:IsKeyDown(Enum.KeyCode.H) then
  53. remote:FireServer(block.Position + UDim2.new(0,0.035,0,0))
  54. wait(0.075)
  55. end
  56. end)
  57. end)()
  58. ]], owner.PlayerGui)
  59. local tween
  60. coroutine.wrap(function()
  61. mr.OnServerEvent:Connect(function(plr,pos)
  62. local tweenService = game:GetService("TweenService")
  63. local timeToFade = 0.075
  64. local object = Gui1
  65. local tweenInfo = TweenInfo.new(timeToFade)
  66. local goal = {}
  67. goal.Position = pos
  68. tween = tweenService:Create(object, tweenInfo, goal)
  69. tween:Play()
  70. local relativePostion = Gui1.AbsolutePosition - Gui2.AbsolutePosition
  71. local clampedX = math.clamp(relativePostion.X, 0, Gui2.AbsoluteSize.X)
  72. local clampedY = math.clamp(relativePostion.Y, 0, Gui2.AbsoluteSize.Y)
  73. Gui1.Position = UDim2.new(0,clampedX,0,clampedY) + Gui2.Position
  74. end)
  75. end)()
Add Comment
Please, Sign In to add comment