mewishmeww

supa dupa v2

Mar 8th, 2025
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.68 KB | None | 0 0
  1. local Players = game:GetService("Players")
  2. local RunService = game:GetService("RunService")
  3.  
  4. local localPlayer = Players.LocalPlayer
  5. local character = localPlayer.Character or localPlayer.CharacterAdded:Wait()
  6. local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
  7.  
  8. local targetPlayerName = "TargetUsername" -- Change this to the player you want to copy
  9. local targetCharacter = nil
  10. local targetRootPart = nil
  11. local lastPosition = nil
  12. local lastVelocity = nil
  13. local lastUpdateTime = tick()
  14. local smoothingFactor = 15 -- Higher means smoother transitions
  15.  
  16. local function findTarget()
  17. local targetPlayer = Players:FindFirstChild(targetPlayerName)
  18. if targetPlayer and targetPlayer.Character then
  19. targetCharacter = targetPlayer.Character
  20. targetRootPart = targetCharacter:FindFirstChild("HumanoidRootPart")
  21. lastPosition = targetRootPart.Position
  22. lastVelocity = targetRootPart.Velocity
  23. end
  24. end
  25.  
  26. local function predictTargetPosition()
  27. if not targetRootPart then return end
  28.  
  29. local currentTime = tick()
  30. local timeElapsed = currentTime - lastUpdateTime
  31. local predictedPosition = targetRootPart.Position + (targetRootPart.Velocity * timeElapsed)
  32.  
  33. lastPosition = targetRootPart.Position
  34. lastVelocity = targetRootPart.Velocity
  35. lastUpdateTime = currentTime
  36.  
  37. return predictedPosition
  38. end
  39.  
  40. RunService.RenderStepped:Connect(function(deltaTime)
  41. if not targetRootPart then findTarget() end
  42. if not targetRootPart then return end
  43.  
  44. local predictedPosition = predictTargetPosition()
  45. humanoidRootPart.Position = humanoidRootPart.Position:Lerp(predictedPosition, deltaTime * smoothingFactor)
  46. end)
Advertisement
Add Comment
Please, Sign In to add comment