Josiahiscool73

headsit

Sep 27th, 2026
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.89 KB | None | 0 0
  1. local Players = game:GetService("Players")
  2. local RunService = game:GetService("RunService")
  3. local TweenService = game:GetService("TweenService")
  4. local UserInputService = game:GetService("UserInputService")
  5. local Stats = game:GetService("Stats")
  6. local CoreGui = game:GetService("CoreGui")
  7. local LocalPlayer = Players.LocalPlayer
  8. local mouse = LocalPlayer:GetMouse()
  9. local sitting = false
  10. local targetPlayer = nil
  11. local basePrediction = 0.1
  12. local calculatedPhysicsPing = 0
  13. local ScreenGui = Instance.new("ScreenGui")
  14.  
  15. ScreenGui.Name = "HeadsitGUI"
  16. ScreenGui.ResetOnSpawn = false
  17.  
  18. -- Useless ai bs
  19. local success, uiParent = pcall(function() return gethui() or CoreGui end)
  20. if not success then uiParent = LocalPlayer:WaitForChild("PlayerGui") end
  21. ScreenGui.Parent = uiParent
  22. local MainFrame = Instance.new("Frame")
  23. MainFrame.Size = UDim2.new(0, 200, 0, 230)
  24. MainFrame.Position = UDim2.new(0.5, -100, 0.5, -115)
  25. MainFrame.BackgroundColor3 = Color3.fromRGB(35, 35, 35)
  26. MainFrame.BorderSizePixel = 0
  27. MainFrame.Parent = ScreenGui
  28. local UICorner = Instance.new("UICorner")
  29. UICorner.CornerRadius = UDim.new(0, 8)
  30. UICorner.Parent = MainFrame
  31. local Title = Instance.new("TextLabel")
  32. Title.Size = UDim2.new(1, 0, 0, 30)
  33. Title.BackgroundTransparency = 1
  34. Title.Text = "Headsit + Ping"
  35. Title.TextColor3 = Color3.fromRGB(255, 255, 255)
  36. Title.Font = Enum.Font.GothamBold
  37. Title.TextSize = 14
  38. Title.Parent = MainFrame
  39. local TargetBox = Instance.new("TextBox")
  40. TargetBox.Size = UDim2.new(0.9, 0, 0, 30)
  41. TargetBox.Position = UDim2.new(0.05, 0, 0, 40)
  42. TargetBox.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
  43. TargetBox.TextColor3 = Color3.fromRGB(255, 255, 255)
  44. TargetBox.PlaceholderText = "Target Name..."
  45. TargetBox.Font = Enum.Font.Gotham
  46. TargetBox.TextSize = 14
  47. TargetBox.Parent = MainFrame
  48. local PredictionBox = Instance.new("TextBox")
  49. PredictionBox.Size = UDim2.new(0.9, 0, 0, 30)
  50. PredictionBox.Position = UDim2.new(0.05, 0, 0, 80)
  51. PredictionBox.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
  52. PredictionBox.TextColor3 = Color3.fromRGB(255, 255, 255)
  53. PredictionBox.PlaceholderText = "Base Predict (e.g. 0.1)"
  54. PredictionBox.Text = "0.1"
  55. PredictionBox.Font = Enum.Font.Gotham
  56. PredictionBox.TextSize = 14
  57. PredictionBox.Parent = MainFrame
  58. local SitButton = Instance.new("TextButton")
  59. SitButton.Size = UDim2.new(0.9, 0, 0, 35)
  60. SitButton.Position = UDim2.new(0.05, 0, 0, 125)
  61. SitButton.BackgroundColor3 = Color3.fromRGB(0, 150, 255)
  62. SitButton.TextColor3 = Color3.fromRGB(255, 255, 255)
  63. SitButton.Text = "Start Headsit"
  64. SitButton.Font = Enum.Font.GothamBold
  65. SitButton.TextSize = 14
  66. SitButton.Parent = MainFrame
  67. local PingButton = Instance.new("TextButton")
  68. PingButton.Size = UDim2.new(0.9, 0, 0, 35)
  69. PingButton.Position = UDim2.new(0.05, 0, 0, 175)
  70. PingButton.BackgroundColor3 = Color3.fromRGB(255, 100, 100)
  71. PingButton.TextColor3 = Color3.fromRGB(255, 255, 255)
  72. PingButton.Text = "Get Ping Tool"
  73. PingButton.Font = Enum.Font.GothamBold
  74. PingButton.TextSize = 14
  75. PingButton.Parent = MainFrame
  76. local dragging, dragInput, dragStart, startPos
  77. MainFrame.InputBegan:Connect(function(input)
  78. if input.UserInputType == Enum.UserInputType.MouseButton1 then
  79. dragging = true
  80. dragStart = input.Position
  81. startPos = MainFrame.Position
  82. input.Changed:Connect(function()
  83. if input.UserInputState == Enum.UserInputState.End then dragging = false end
  84. end)
  85. end
  86. end)
  87. MainFrame.InputChanged:Connect(function(input)
  88. if input.UserInputType == Enum.UserInputType.MouseMovement then dragInput = input end
  89. end)
  90. UserInputService.InputChanged:Connect(function(input)
  91. if input == dragInput and dragging then
  92. local delta = input.Position - dragStart
  93. MainFrame.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
  94. end
  95. end)
  96. local function getPlayer(nameStr)
  97. if not nameStr or nameStr == "" then return nil end
  98. local lowerName = string.lower(nameStr)
  99. for _, p in ipairs(Players:GetPlayers()) do
  100. if p ~= LocalPlayer then
  101. if string.sub(string.lower(p.Name), 1, #lowerName) == lowerName or string.sub(string.lower(p.DisplayName), 1, #lowerName) == lowerName then
  102. return p
  103. end
  104. end
  105. end
  106. return nil
  107. end
  108. local function getNetworkPing()
  109. local activePing = 0
  110. local success, result = pcall(function()
  111. local label = CoreGui.RobloxGui.PerformanceStats:GetChildren()[6].StatsMiniTextPanelClass.ValueLabel
  112. return label.Text
  113. end)
  114. if success and type(result) == "string" then
  115. local numStr = string.match(result, "[%d%.]+")
  116. if numStr then return tonumber(numStr) end
  117. end
  118. local statSuccess, statResult = pcall(function()
  119. return Stats.Network.ServerStatsItem["Data Ping"]:GetValue()
  120. end)
  121.  
  122. if statSuccess and type(statResult) == "number" then
  123. return statResult
  124. end
  125.  
  126. return activePing
  127. end
  128.  
  129. PredictionBox.FocusLost:Connect(function()
  130. local val = tonumber(PredictionBox.Text)
  131. if val then
  132. basePrediction = val
  133. else
  134. PredictionBox.Text = tostring(basePrediction)
  135. end
  136. end)
  137. SitButton.MouseButton1Click:Connect(function()
  138. sitting = not sitting
  139. if sitting then
  140. local p = getPlayer(TargetBox.Text)
  141. if p then
  142. targetPlayer = p
  143. SitButton.Text = "Stop Headsit"
  144. SitButton.BackgroundColor3 = Color3.fromRGB(255, 50, 50)
  145.  
  146. local hum = LocalPlayer.Character and LocalPlayer.Character:FindFirstChild("Humanoid")
  147. if hum then hum.Sit = true end
  148. else
  149. sitting = false
  150. SitButton.Text = "Player not found!"
  151. task.wait(1)
  152. SitButton.Text = "Start Headsit"
  153. SitButton.BackgroundColor3 = Color3.fromRGB(0, 150, 255)
  154. end
  155. else
  156. targetPlayer = nil
  157. SitButton.Text = "Start Headsit"
  158. SitButton.BackgroundColor3 = Color3.fromRGB(0, 150, 255)
  159. Title.Text = "Headsit + Ping"
  160.  
  161. local hum = LocalPlayer.Character and LocalPlayer.Character:FindFirstChild("Humanoid")
  162. if hum then hum.Sit = false end
  163. end
  164. end)
  165.  
  166. RunService.Heartbeat:Connect(function()
  167. if sitting and targetPlayer and targetPlayer.Character then
  168. local lChar = LocalPlayer.Character
  169. local tChar = targetPlayer.Character
  170.  
  171. local myHRP = lChar and lChar:FindFirstChild("HumanoidRootPart")
  172. local tHRP = tChar and tChar:FindFirstChild("HumanoidRootPart")
  173. local myHum = lChar and lChar:FindFirstChild("Humanoid")
  174.  
  175. if myHRP and tHRP then
  176. if myHum and not myHum.Sit then myHum.Sit = true end
  177.  
  178. for _, part in ipairs(lChar:GetDescendants()) do
  179. if part:IsA("BasePart") then part.CanCollide = false end
  180. end
  181.  
  182. local dynamicPingDelay = 0
  183. if calculatedPhysicsPing > 0 then
  184. local currentNetPing = getNetworkPing()
  185. local differenceMs = math.max(0, calculatedPhysicsPing - currentNetPing)
  186.  
  187. dynamicPingDelay = differenceMs / 1000
  188.  
  189. Title.Text = string.format("Net: %d | Delay: %d", currentNetPing, differenceMs)
  190. end
  191.  
  192. local totalPrediction = basePrediction + dynamicPingDelay
  193.  
  194. local verticalOffset = CFrame.new(0, 2.35, 0)
  195. local predictedVelocityOffset = (tHRP.AssemblyLinearVelocity * totalPrediction)
  196.  
  197. myHRP.CFrame = (tHRP.CFrame + predictedVelocityOffset) * verticalOffset
  198.  
  199. myHRP.AssemblyLinearVelocity = Vector3.new(0, 0, 0)
  200. myHRP.AssemblyAngularVelocity = Vector3.new(0, 0, 0)
  201. end
  202. end
  203. end)
  204.  
  205. PingButton.MouseButton1Click:Connect(function()
  206. if LocalPlayer.Backpack:FindFirstChild("PingCheck") then
  207. PingButton.Text = "Already have Tool!"
  208. task.wait(1)
  209. PingButton.Text = "Get Ping Tool"
  210. return
  211. end
  212.  
  213. local tool = Instance.new("Tool")
  214. tool.Name = "PingCheck"
  215. tool.RequiresHandle = false
  216. tool.Parent = LocalPlayer.Backpack
  217.  
  218. local function getHRP(p)
  219. local c = p and p.Character
  220. return c and c:FindFirstChild("HumanoidRootPart")
  221. end
  222.  
  223. local function noCollide(c)
  224. for _, d in ipairs(c:GetDescendants()) do
  225. if d:IsA("BasePart") then d.CanCollide = false end
  226. end
  227. end
  228.  
  229. local function slide(part, goal, dur)
  230. local tw = TweenService:Create(part, TweenInfo.new(dur, Enum.EasingStyle.Linear), { CFrame = goal })
  231. tw:Play()
  232. tw.Completed:Wait()
  233. end
  234.  
  235. local function run(target)
  236. local th = getHRP(target)
  237. local mh = getHRP(LocalPlayer)
  238. if not th or not mh then return end
  239.  
  240. noCollide(LocalPlayer.Character)
  241. task.wait(0.2)
  242.  
  243. local last = th.Position
  244. local still = 0
  245. while still < 30 do
  246. RunService.Heartbeat:Wait()
  247. th = getHRP(target) or th
  248. local p = th.Position
  249. if (p - last).Magnitude > 0.15 then still = 0 else still += 1 end
  250. last = p
  251. end
  252.  
  253. mh = getHRP(LocalPlayer) or mh
  254. th = getHRP(target) or th
  255. slide(mh, th.CFrame * CFrame.new(0, 0, 10), 1.2)
  256. task.wait(0.5)
  257.  
  258. local t0 = nil
  259. local p0 = nil
  260. local moved = false
  261. local ms = 0
  262. local done = false
  263. local endT = nil
  264.  
  265. task.spawn(function()
  266. local m = getHRP(LocalPlayer) or mh
  267. local t = getHRP(target) or th
  268. slide(m, t.CFrame * CFrame.new(0, 0, -10), 1.2)
  269. done = true
  270. endT = os.clock()
  271. end)
  272.  
  273. while not moved do
  274. RunService.Heartbeat:Wait()
  275. mh = getHRP(LocalPlayer) or mh
  276. th = getHRP(target) or th
  277.  
  278. if not t0 then
  279. if (mh.Position - th.Position).Magnitude <= 3 then
  280. t0 = os.clock()
  281. p0 = th.Position
  282. elseif done and endT and (os.clock() - endT) > 5 then
  283. break
  284. end
  285. else
  286. ms = (os.clock() - t0) * 1000
  287. if (th.Position - p0).Magnitude > 0.05 then
  288. moved = true
  289. elseif ms > 5000 then
  290. break
  291. end
  292. end
  293. end
  294.  
  295. if moved then
  296. print(string.format("Calculated Physics Ping: %.6f ms", ms))
  297. -- Updates our total physics ping delay variable
  298. calculatedPhysicsPing = ms
  299. Title.Text = string.format("Phys Ping: %dms", ms)
  300. end
  301. end
  302.  
  303. tool.Activated:Connect(function()
  304. local hit = mouse.Target
  305. if not hit then return end
  306. local model = hit:FindFirstAncestorOfClass("Model")
  307. if not model then return end
  308. local plr = Players:GetPlayerFromCharacter(model)
  309. if plr and plr ~= LocalPlayer then
  310. run(plr)
  311. end
  312. end)
  313.  
  314. PingButton.Text = "Tool Given!"
  315. task.wait(1)
  316. PingButton.Text = "Get Ping Tool"
  317. end)
Advertisement
Add Comment
Please, Sign In to add comment