Advertisement
Freshbloodb

Untitled

Dec 26th, 2024
13
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.24 KB | None | 0 0
  1. local Players = game:GetService("Players")
  2. local RunService = game:GetService("RunService")
  3.  
  4. local player = Players.LocalPlayer
  5. local character = player.Character or player.CharacterAdded:Wait()
  6.  
  7. local function setupCharacter(char)
  8. -- Desactivar colisión con otros jugadores
  9. local function updateCollision()
  10. for _, otherPlayer in ipairs(Players:GetPlayers()) do
  11. if otherPlayer ~= player and otherPlayer.Character then
  12. local otherHumanoidRootPart = otherPlayer.Character:FindFirstChild("HumanoidRootPart")
  13. if otherHumanoidRootPart then
  14. otherHumanoidRootPart.CanCollide = false
  15. end
  16. end
  17. end
  18. end
  19.  
  20. -- Prevenir caídas
  21. local function preventFalling()
  22. local humanoid = char:FindFirstChild("Humanoid")
  23. if humanoid then
  24. humanoid.PlatformStand = false
  25. humanoid:SetStateEnabled(Enum.HumanoidStateType.FallingDown, false)
  26. humanoid:SetStateEnabled(Enum.HumanoidStateType.Ragdoll, false)
  27. end
  28.  
  29. local humanoidRootPart = char:FindFirstChild("HumanoidRootPart")
  30. if humanoidRootPart then
  31. humanoidRootPart.CanCollide = true
  32. if humanoidRootPart.Position.Y < 0 then
  33. humanoidRootPart.CFrame = CFrame.new(humanoidRootPart.Position.X, 0, humanoidRootPart.Position.Z)
  34. end
  35. end
  36. end
  37.  
  38. RunService.Heartbeat:Connect(function()
  39. updateCollision()
  40. preventFalling()
  41. end)
  42. end
  43.  
  44. setupCharacter(character)
  45.  
  46. player.CharacterAdded:Connect(function(newCharacter)
  47. character = newCharacter
  48. setupCharacter(character)
  49. end)
  50.  
  51. print("Script de no colisión y anti-caída activado")
  52.  
  53. -- Inicialización de variables globales con valores predeterminados
  54. _G.enableLockt6kla = _G.enableLockt6kla or false
  55. _G.KEY = _G.KEY or "q"
  56. _G.PART = _G.PART or "HumanoidRootPart"
  57. _G.PRED = _G.PRED or 0.1
  58. _G.USE_PING = _G.USE_PING or true
  59. _G.SMOOTH = _G.SMOOTH or 0.1
  60. _G.MIN_DISTANCE = _G.MIN_DISTANCE or 5
  61. _G.MAX_VELOCITY_ADJUSTMENT = _G.MAX_VELOCITY_ADJUSTMENT or 50
  62.  
  63. local Players = game:GetService("Players")
  64. local RunService = game:GetService("RunService")
  65. local camera = game.Workspace.CurrentCamera
  66. local localPlayer = Players.LocalPlayer
  67. local targetPlayer
  68. local isTracking = false
  69. local pingPrediction = _G.PRED
  70. local mouse = localPlayer:GetMouse()
  71. local markerPart = Instance.new("Part", game.Workspace)
  72.  
  73. markerPart.Anchored = true
  74. markerPart.CanCollide = false
  75. markerPart.Transparency = 1 -- Invisible
  76. markerPart.Size = Vector3.new(0.2, 0.2, 0.2)
  77.  
  78. -- Obtener ping y calcular predicción
  79. RunService.Heartbeat:Connect(function()
  80. if not _G.enableLockt6kla then return end
  81. if _G.USE_PING then
  82. local pingValue = tonumber(game:GetService("Stats").Network.ServerStatsItem["Data Ping"]:GetValueString():match("%d+"))
  83. pingPrediction = (pingValue / 1000) + _G.PRED
  84. else
  85. pingPrediction = _G.PRED
  86. end
  87. end)
  88.  
  89. -- Anti-Antilocks
  90. RunService.Heartbeat:Connect(function()
  91. if not _G.enableLockt6kla then return end
  92. pcall(function()
  93. for _, player in ipairs(Players:GetPlayers()) do
  94. if player ~= localPlayer and player.Character and player.Character:FindFirstChild(_G.PART) then
  95. local hrp = player.Character[_G.PART]
  96. local velocityAdjustment = hrp.Velocity * pingPrediction
  97.  
  98. -- Limitar velocidad máxima
  99. if velocityAdjustment.Magnitude > _G.MAX_VELOCITY_ADJUSTMENT then
  100. velocityAdjustment = velocityAdjustment.Unit * _G.MAX_VELOCITY_ADJUSTMENT
  101. end
  102.  
  103. hrp.Velocity = hrp.Velocity + velocityAdjustment
  104. end
  105. end
  106. end)
  107. end)
  108.  
  109. -- Predicción segura sin colisiones
  110. function getPredictedPosition(targetPart)
  111. local velocity = targetPart.Velocity
  112. local adjustedVelocity = velocity * pingPrediction
  113.  
  114. if adjustedVelocity.Magnitude > _G.MAX_VELOCITY_ADJUSTMENT then
  115. adjustedVelocity = adjustedVelocity.Unit * _G.MAX_VELOCITY_ADJUSTMENT
  116. end
  117.  
  118. return targetPart.Position + adjustedVelocity
  119. end
  120.  
  121. -- Ajustar rotación de la cámara
  122. function adjustCameraRotation(predictedPosition)
  123. local cameraPosition = camera.CFrame.Position
  124. local directionToTarget = (predictedPosition - cameraPosition).Unit
  125. local targetCFrame = CFrame.new(cameraPosition, cameraPosition + directionToTarget)
  126.  
  127. local distanceToTarget = (cameraPosition - predictedPosition).Magnitude
  128. if distanceToTarget < _G.MIN_DISTANCE then
  129. predictedPosition = cameraPosition + directionToTarget * _G.MIN_DISTANCE
  130. end
  131.  
  132. camera.CFrame = camera.CFrame:Lerp(targetCFrame, _G.SMOOTH)
  133. end
  134.  
  135. -- Actualizar marcador y cámara
  136. RunService.RenderStepped:Connect(function()
  137. if not _G.enableLockt6kla then return end
  138. if isTracking and targetPlayer and targetPlayer.Character then
  139. local humanoid = targetPlayer.Character:FindFirstChild("Humanoid")
  140. if not humanoid or humanoid.Health < 10 then
  141. isTracking = false
  142. targetPlayer = nil
  143. print("Seguimiento desactivado: objetivo muerto o con poca vida")
  144. return
  145. end
  146.  
  147. local targetPart = targetPlayer.Character:FindFirstChild(_G.PART)
  148. if targetPart then
  149. local predictedPosition = getPredictedPosition(targetPart)
  150. markerPart.Position = predictedPosition
  151. adjustCameraRotation(predictedPosition)
  152. else
  153. isTracking = false
  154. targetPlayer = nil
  155. print("Seguimiento desactivado: parte objetivo no encontrada")
  156. end
  157. else
  158. markerPart.Position = Vector3.new(0, -1000, 0)
  159. end
  160. end)
  161.  
  162. -- Alternar seguimiento con la tecla asignada
  163. mouse.KeyDown:Connect(function(key)
  164. if not _G.enableLockt6kla then return end
  165. if key:lower() == _G.KEY then
  166. if isTracking then
  167. isTracking = false
  168. targetPlayer = nil
  169. print("Seguimiento desactivado")
  170. else
  171. targetPlayer = getClosestPlayer()
  172. if targetPlayer then
  173. isTracking = true
  174. print("Siguiendo a:", targetPlayer.Name)
  175. else
  176. print("No se encontró ningún jugador cercano")
  177. end
  178. end
  179. end
  180. end)
  181.  
  182. -- Obtener el jugador más cercano
  183. function getClosestPlayer()
  184. local closestPlayer = nil
  185. local shortestDistance = math.huge
  186.  
  187. for _, player in ipairs(Players:GetPlayers()) do
  188. if player ~= localPlayer and player.Character and
  189. player.Character:FindFirstChild("Humanoid") and player.Character.Humanoid.Health > 10 and
  190. player.Character:FindFirstChild(_G.PART) then
  191.  
  192. local targetPart = player.Character[_G.PART]
  193. local screenPoint = camera:WorldToViewportPoint(targetPart.Position)
  194. local distance = (Vector2.new(screenPoint.X, screenPoint.Y) - Vector2.new(mouse.X, mouse.Y)).Magnitude
  195.  
  196. if distance < shortestDistance then
  197. closestPlayer = player
  198. shortestDistance = distance
  199. end
  200. end
  201. end
  202.  
  203. return closestPlayer
  204. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement