Alright so ive wanted to make a ball/marble player system where the player can roll and jump around with all of that stuff; every single time ive tried to achieve this has always been by faking it in some kind of way instead of making an actual rolling system**. Like, I’ve given the player a fake ball over their humanoid with rolling animations but id like to actually you know… make the player roll. using my methods, everything was in the hands of the Roblox physics which arent even that good. Should I fake it further or actually make a rolling system?? Something like this.
local Char = script.Parent
local Ball = game.ServerStorage.ball:Clone()
local Weld = Instance.new("WeldConstraint")
Weld.Parent = Ball
Weld.Part0 = Ball
Weld.Part1 = Char.HumanoidRootPart
Ball.Position = Char.HumanoidRootPart.Position
Ball.Parent = Char
Having had a look at the game you mentioned, i feel that for something like that, using the Torque mover constraint would be the best option here.
this kind of Torque should be relative to the camera - if you want to go left/right, then you have to apply a torque through the camera’s look axis.
forward and backward mean rotating through the camera’s right axis.
for jumping, you could set the ball’s velocity directly - if the velocity’s y is 0 then maybe change it to 10, else let it fall.
local speed = 100 -- increase for more torque
local jumpForce = 1000
local grounded = false
local direction = Vector3.zero
-- Detect movement input
UserInputService.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.Space and grounded then
ball:ApplyImpulse(Vector3.new(0, jumpForce, 0))
end
end)
RunService.RenderStepped:Connect(function()
-- Get input direction
local moveDir = Vector3.zero
if UserInputService:IsKeyDown(Enum.KeyCode.W) then
moveDir += Vector3.new(0, 0, -1)
end
if UserInputService:IsKeyDown(Enum.KeyCode.S) then
moveDir += Vector3.new(0, 0, 1)
end
if UserInputService:IsKeyDown(Enum.KeyCode.A) then
moveDir += Vector3.new(-1, 0, 0)
end
if UserInputService:IsKeyDown(Enum.KeyCode.D) then
moveDir += Vector3.new(1, 0, 0)
end
if moveDir.Magnitude > 0 then
moveDir = moveDir.Unit
local cameraCFrame = camera.CFrame
local camRight = cameraCFrame.RightVector
local camLook = cameraCFrame.LookVector
local moveVector = (camRight * moveDir.X + camLook * moveDir.Z).Unit
ball:ApplyTorque(Vector3.new(moveVector.Z, 0, -moveVector.X) * speed)
end
end)
and this as local script
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")
-- Create the ball
local ball = Instance.new("Part")
ball.Shape = Enum.PartType.Ball
ball.Size = Vector3.new(5,5,5)
ball.Material = Enum.Material.SmoothPlastic
ball.Position = Vector3.new(0, 10, 0)
ball.Anchored = false
ball.Name = "PlayerBall"
ball.CanCollide = true
ball.TopSurface = Enum.SurfaceType.Smooth
ball.BottomSurface = Enum.SurfaceType.Smooth
ball.Parent = workspace
-- Physics stuff
ball.AssemblyLinearVelocity = Vector3.zero
ball.AssemblyAngularVelocity = Vector3.zero
ball.Massless = false
-- Camera follows ball
local camera = workspace.CurrentCamera
camera.CameraSubject = ball
camera.CameraType = Enum.CameraType.Custom