1. local UserInputService = game:GetService("UserInputService")
  2. local RunService = game:GetService("RunService")
  3. local Camera = workspace.CurrentCamera
  4. local SPEED_MULTIPLIER = 30
  5. local JUMP_POWER = 60
  6. local JUMP_GAP = 0.3
  7. local character = game.Players.LocalPlayer.Character
  8. for i,v in ipairs(character:GetDescendants()) do
  9. if v:IsA("BasePart") then
  10. v.CanCollide = false
  11. end
  12. end
  13. local ball = character.HumanoidRootPart
  14. ball.Shape = Enum.PartType.Ball
  15. ball.Size = Vector3.new(5,5,5)
  16. local humanoid = character:WaitForChild("Humanoid")
  17. local params = RaycastParams.new()
  18. params.FilterType = Enum.RaycastFilterType.Blacklist
  19. params.FilterDescendantsInstances = {character}
  20. local tc = RunService.RenderStepped:Connect(function(delta)
  21. ball.CanCollide = true
  22. humanoid.PlatformStand = true
  23. if UserInputService:GetFocusedTextBox() then return end
  24. if UserInputService:IsKeyDown("W") then
  25. ball.RotVelocity -= Camera.CFrame.RightVector * delta * SPEED_MULTIPLIER
  26. end
  27. if UserInputService:IsKeyDown("A") then
  28. ball.RotVelocity -= Camera.CFrame.LookVector * delta * SPEED_MULTIPLIER
  29. end
  30. if UserInputService:IsKeyDown("S") then
  31. ball.RotVelocity += Camera.CFrame.RightVector * delta * SPEED_MULTIPLIER
  32. end
  33. if UserInputService:IsKeyDown("D") then
  34. ball.RotVelocity += Camera.CFrame.LookVector * delta * SPEED_MULTIPLIER
  35. end
  36. --ball.RotVelocity = ball.RotVelocity - Vector3.new(0,ball.RotVelocity.Y/50,0)
  37. end)
  38. UserInputService.JumpRequest:Connect(function()
  39. local result = workspace:Raycast(
  40. ball.Position,
  41. Vector3.new(
  42. 0,
  43. -((ball.Size.Y/2)+JUMP_GAP),
  44. 0
  45. ),
  46. params
  47. )
  48. if result then
  49. ball.Velocity = ball.Velocity + Vector3.new(0,JUMP_POWER,0)
  50. end
  51. end)
  52. Camera.CameraSubject = ball
  53. humanoid.Died:Connect(function() tc:Disconnect() end)