Advertisement
GhosterX

King Script !beta!

May 30th, 2025 (edited)
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.41 KB | None | 0 0
  1. local Players = game:GetService("Players")
  2. local RunService = game:GetService("RunService")
  3. local UserInputService = game:GetService("UserInputService")
  4. local player = Players.LocalPlayer
  5.  
  6. local driftLerp = 0.01 -- Drift bem escorregadio
  7. local driftSpeed = 30
  8.  
  9. _G.DriftAtivo = false
  10.  
  11. -- Detecta se o shiftlock está ativo
  12. local function isShiftLockActive()
  13. -- No Roblox padrão, ShiftLockSwitchMode = "MouseLockSwitch"
  14. -- e CameraMode = "Classic"
  15. -- Quando shiftlock está ativo, o MouseBehavior é LockCenter
  16. return UserInputService.MouseBehavior == Enum.MouseBehavior.LockCenter
  17. end
  18.  
  19. local function sentarR6(humanoid)
  20. if humanoid and not humanoid.Sit then
  21. humanoid.Sit = true
  22. end
  23. end
  24.  
  25. local function pararSentar(humanoid)
  26. if humanoid and humanoid.Sit then
  27. humanoid.Sit = false
  28. end
  29. end
  30.  
  31. local function driftLoop(char)
  32. local humanoid = char:WaitForChild("Humanoid")
  33. local hrp = char:WaitForChild("HumanoidRootPart")
  34. local vel = Vector3.new()
  35. RunService.RenderStepped:Connect(function()
  36. if _G.DriftAtivo and humanoid.Health > 0 then
  37. sentarR6(humanoid)
  38. humanoid.WalkSpeed = driftSpeed
  39. local moveDir = humanoid.MoveDirection
  40. if moveDir.Magnitude > 0 then
  41. local targetVel = moveDir.Unit * driftSpeed
  42. vel = vel:Lerp(targetVel, driftLerp)
  43. else
  44. vel = vel:Lerp(Vector3.new(), driftLerp)
  45. end
  46. hrp.AssemblyLinearVelocity = Vector3.new(vel.X, hrp.AssemblyLinearVelocity.Y, vel.Z)
  47.  
  48. -- Rotação do corpo:
  49. if isShiftLockActive() then
  50. -- Shiftlock: corpo segue a câmera
  51. local cam = workspace.CurrentCamera
  52. local camLook = cam.CFrame.LookVector
  53. local lookVec = Vector3.new(camLook.X, 0, camLook.Z).Unit
  54. hrp.CFrame = CFrame.new(hrp.Position, hrp.Position + lookVec)
  55. else
  56. -- Sem shiftlock: corpo segue a direção do movimento
  57. if vel.Magnitude > 0.1 then
  58. local lookVec = Vector3.new(vel.X, 0, vel.Z).Unit
  59. hrp.CFrame = CFrame.new(hrp.Position, hrp.Position + lookVec)
  60. end
  61. end
  62. else
  63. pararSentar(humanoid)
  64. humanoid.WalkSpeed = 16
  65. end
  66. end)
  67. end
  68.  
  69. local function criarBotaoDrift()
  70. if player.PlayerGui:FindFirstChild("DriftGui") then return end
  71. local screenGui = Instance.new("ScreenGui")
  72. screenGui.Name = "DriftGui"
  73. screenGui.ResetOnSpawn = false
  74. screenGui.Parent = player.PlayerGui
  75.  
  76. local btn = Instance.new("TextButton")
  77. btn.Name = "DriftToggle"
  78. btn.Size = UDim2.new(0, 80, 0, 30)
  79. btn.Position = UDim2.new(1, -90, 1, -40)
  80. btn.BackgroundColor3 = Color3.fromRGB(30,30,30)
  81. btn.TextColor3 = Color3.new(1,1,1)
  82. btn.Text = "Drift: OFF"
  83. btn.TextScaled = true
  84. btn.BackgroundTransparency = 0.2
  85. btn.BorderSizePixel = 0
  86. btn.Parent = screenGui
  87.  
  88. btn.MouseButton1Click:Connect(function()
  89. _G.DriftAtivo = not _G.DriftAtivo
  90. btn.Text = _G.DriftAtivo and "Drift: ON" or "Drift: OFF"
  91. end)
  92. end
  93.  
  94. player.CharacterAdded:Connect(function(char)
  95. criarBotaoDrift()
  96. driftLoop(char)
  97. end)
  98.  
  99. criarBotaoDrift()
  100. if player.Character then
  101. driftLoop(player.Character)
  102. end
  103.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement