Kenken_I

Untitled

Jun 26th, 2025
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.43 KB | None | 0 0
  1. local TweenService = game:GetService("TweenService")
  2. local Players = game:GetService("Players")
  3. local player = Players.LocalPlayer
  4. local playerGui = player:WaitForChild("PlayerGui")
  5.  
  6. -- GUI setup
  7. local screenGui = Instance.new("ScreenGui")
  8. screenGui.Name = "MoveGui"
  9. screenGui.ResetOnSpawn = false
  10. screenGui.Parent = playerGui
  11.  
  12. local frame = Instance.new("Frame")
  13. frame.Size = UDim2.new(0, 220, 0, 200)
  14. frame.Position = UDim2.new(0.5, -110, 0.5, -100)
  15. frame.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
  16. frame.BorderSizePixel = 0
  17. frame.Active = true
  18. frame.Draggable = true
  19. frame.Parent = screenGui
  20.  
  21. local title = Instance.new("TextLabel")
  22. title.Size = UDim2.new(1, 0, 0, 30)
  23. title.BackgroundTransparency = 1
  24. title.Text = "Move + Teleport"
  25. title.TextColor3 = Color3.new(1, 1, 1)
  26. title.Font = Enum.Font.SourceSansBold
  27. title.TextSize = 18
  28. title.Parent = frame
  29.  
  30. -- Buttons
  31. local function createButton(name, posY)
  32. local btn = Instance.new("TextButton")
  33. btn.Size = UDim2.new(0, 200, 0, 40)
  34. btn.Position = UDim2.new(0, 10, 0, posY)
  35. btn.BackgroundColor3 = Color3.fromRGB(70, 130, 180)
  36. btn.TextColor3 = Color3.new(1, 1, 1)
  37. btn.Text = name
  38. btn.Font = Enum.Font.SourceSansBold
  39. btn.TextSize = 18
  40. btn.Parent = frame
  41. return btn
  42. end
  43.  
  44. local activateBtn = createButton("Activate Forward + Up", 40)
  45. local saveZoneBtn = createButton("Save Collect Zone Position", 90)
  46. local goToZoneBtn = createButton("Tween to Saved Zone", 140)
  47.  
  48. -- Variables
  49. local savedCollectPosition = nil
  50. local speed = 19 / 0.65 -- ≈ 27.14 studs/sec
  51.  
  52. -- Tween forward and teleport up
  53. local function moveForwardThenUp()
  54. local character = player.Character
  55. if not character then return end
  56. local root = character:FindFirstChild("HumanoidRootPart")
  57. if not root then return end
  58.  
  59. local distance = 48
  60. local forward = root.CFrame.LookVector
  61. local targetPos = root.Position + (forward * distance)
  62. local targetCFrame = CFrame.new(targetPos, targetPos + forward)
  63. local duration = distance / speed
  64.  
  65. local tweenInfo = TweenInfo.new(duration, Enum.EasingStyle.Sine, Enum.EasingDirection.Out)
  66. local tween = TweenService:Create(root, tweenInfo, {CFrame = targetCFrame})
  67. tween:Play()
  68.  
  69. tween.Completed:Connect(function()
  70. local upPos = root.Position + Vector3.new(0, 300, 0)
  71. root.CFrame = CFrame.new(upPos, upPos + forward)
  72. end)
  73. end
  74.  
  75. -- Save current position
  76. saveZoneBtn.MouseButton1Click:Connect(function()
  77. local character = player.Character
  78. if character and character:FindFirstChild("HumanoidRootPart") then
  79. savedCollectPosition = character.HumanoidRootPart.Position
  80. end
  81. end)
  82.  
  83. -- Tween to saved zone
  84. local function tweenToCollectZone()
  85. if not savedCollectPosition then return end
  86. local character = player.Character
  87. if not character then return end
  88. local root = character:FindFirstChild("HumanoidRootPart")
  89. if not root then return end
  90.  
  91. local currentPos = root.Position
  92. local distance = (savedCollectPosition - currentPos).Magnitude
  93. local duration = distance / speed
  94. local lookAt = (savedCollectPosition - currentPos).Unit
  95. local targetCFrame = CFrame.new(savedCollectPosition, savedCollectPosition + lookAt)
  96.  
  97. local tweenInfo = TweenInfo.new(duration, Enum.EasingStyle.Sine, Enum.EasingDirection.Out)
  98. local tween = TweenService:Create(root, tweenInfo, {CFrame = targetCFrame})
  99. tween:Play()
  100. end
  101.  
  102. -- Connect buttons
  103. activateBtn.MouseButton1Click:Connect(moveForwardThenUp)
  104. goToZoneBtn.MouseButton1Click:Connect(tweenToCollectZone)
Advertisement
Add Comment
Please, Sign In to add comment