Advertisement
TSG_lol

FE Ball roll script

Feb 2nd, 2023
2,125
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.78 KB | None | 0 0
  1. -- I DONT OWN THE SCRIPT
  2. local UserInputService = game:GetService("UserInputService")
  3. local RunService = game:GetService("RunService")
  4. local Camera = workspace.CurrentCamera
  5.  
  6. local SPEED_MULTIPLIER = 30
  7. local JUMP_POWER = 60
  8. local JUMP_GAP = 0.3
  9.  
  10. local character = game.Players.LocalPlayer.Character
  11.  
  12. for i,v in ipairs(character:GetDescendants()) do
  13. if v:IsA("BasePart") then
  14. v.CanCollide = false
  15. end
  16. end
  17.  
  18. local ball = character.HumanoidRootPart
  19. ball.Shape = Enum.PartType.Ball
  20. ball.Size = Vector3.new(5,5,5)
  21. local humanoid = character:WaitForChild("Humanoid")
  22. local params = RaycastParams.new()
  23. params.FilterType = Enum.RaycastFilterType.Blacklist
  24. params.FilterDescendantsInstances = {character}
  25.  
  26. local tc = RunService.RenderStepped:Connect(function(delta)
  27. ball.CanCollide = true
  28. humanoid.PlatformStand = true
  29. if UserInputService:GetFocusedTextBox() then return end
  30. if UserInputService:IsKeyDown("W") then
  31. ball.RotVelocity -= Camera.CFrame.RightVector * delta * SPEED_MULTIPLIER
  32. end
  33. if UserInputService:IsKeyDown("A") then
  34. ball.RotVelocity -= Camera.CFrame.LookVector * delta * SPEED_MULTIPLIER
  35. end
  36. if UserInputService:IsKeyDown("S") then
  37. ball.RotVelocity += Camera.CFrame.RightVector * delta * SPEED_MULTIPLIER
  38. end
  39. if UserInputService:IsKeyDown("D") then
  40. ball.RotVelocity += Camera.CFrame.LookVector * delta * SPEED_MULTIPLIER
  41. end
  42. --ball.RotVelocity = ball.RotVelocity - Vector3.new(0,ball.RotVelocity.Y/50,0)
  43. end)
  44.  
  45. UserInputService.JumpRequest:Connect(function()
  46. local result = workspace:Raycast(
  47. ball.Position,
  48. Vector3.new(
  49. 0,
  50. -((ball.Size.Y/2)+JUMP_GAP),
  51. 0
  52. ),
  53. params
  54. )
  55. if result then
  56. ball.Velocity = ball.Velocity + Vector3.new(0,JUMP_POWER,0)
  57. end
  58. end)
  59.  
  60. Camera.CameraSubject = ball
  61. humanoid.Died:Connect(function() tc:Disconnect() end)
Advertisement
Comments
Add Comment
Please, Sign In to add comment
Advertisement