Advertisement
NotExotic

new2

Sep 21st, 2023
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. local newPart = Instance.new("Part")
  2. newPart.Anchored = true -- To prevent it from falling down
  3.  
  4. -- Function to update the part's position
  5. local function updatePartPosition()
  6. local localPlayer = game.Players.LocalPlayer
  7. if localPlayer then
  8. local character = localPlayer.Character
  9. if character and character:FindFirstChild("HumanoidRootPart") then
  10. local newPosition = character.HumanoidRootPart.Position
  11. newPart.Position = Vector3.new(newPosition.X, 20, newPosition.Z)
  12. end
  13. end
  14. end
  15.  
  16. -- Connect the updatePartPosition function to the heartbeat of the RunService
  17. runService.Heartbeat:Connect(updatePartPosition)
  18.  
  19. -- Parent the new part to the workspace (you can change the parent as needed)
  20. newPart.Parent = game.Workspace
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement