MaxproGlitcher

Script save spot .lua

Oct 21st, 2024
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1.  
  2. local player = game.Players.LocalPlayer
  3. local playerGui = player:WaitForChild("PlayerGui")
  4. local screenGui = Instance.new("ScreenGui")
  5. screenGui.Parent = playerGui
  6.  
  7. local button = Instance.new("TextButton")
  8. button.Size = UDim2.new(0, 200, 0, 50)
  9. button.Position = UDim2.new(0.5, -100, 0.5, -25)
  10. button.Text = "Save Spot"
  11. button.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  12. button.TextColor3 = Color3.fromRGB(255, 255, 255)
  13. button.Parent = screenGui
  14.  
  15. local savedPosition = nil
  16.  
  17. local function savePosition()
  18. local character = player.Character or player.CharacterAdded:Wait()
  19. local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
  20.  
  21. savedPosition = humanoidRootPart.Position
  22.  
  23. button.Text = "Teleport to saved spot"
  24. end
  25.  
  26. local function teleportToSavedSpot()
  27. if savedPosition then
  28. local character = player.Character or player.CharacterAdded:Wait()
  29. local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
  30.  
  31. humanoidRootPart.CFrame = CFrame.new(savedPosition)
  32.  
  33. button.Text = "Save Spot"
  34. savedPosition = nil
  35. end
  36. end
  37.  
  38. button.MouseButton1Click:Connect(function()
  39. if savedPosition then
  40. teleportToSavedSpot()
  41. else
  42. savePosition()
  43. end
  44. end)
  45.  
  46. button.Draggable = true
Advertisement
Add Comment
Please, Sign In to add comment