Marble/Ball Script

Hello, I made a Marble/Ball script

-- // Settings

local speed = 80000 -- when holding keys
local breakspeed = 100000 -- when stop holding all keys

--// Yes yes dont look below, it  looks trash
script.Marble:SetNetworkOwnershipAuto()
local marble = script.Marble
local char = script.Parent
local humanoid = char.Humanoid
marble.Parent = script.Parent
local angular = marble.BodyAngularVelocity
humanoid.PlatformStand = true
local weld = Instance.new("WeldConstraint",script.Parent)
marble.Position = char.HumanoidRootPart.Position
weld.Part0= marble
weld.Part1= char.HumanoidRootPart
while true do wait(.5)
	angular.AngularVelocity = Vector3.new(humanoid.MoveDirection.z * 8000,0,humanoid.MoveDirection.x * -8000)
	angular.MaxTorque = Vector3.new(speed,0,speed)
	if humanoid.MoveDirection == Vector3.new(0,0,0) then
		angular.AngularVelocity = Vector3.new(0,0,0)
		angular.MaxTorque = Vector3.new(breakspeed,0,breakspeed)
	end
end```

I was wondering if there's better solutions for that.
Try the marble on ur own here [Speed Script.rbxm|attachment](upload://zko7tRy7cUynFIDQCWa2G2sL8St.rbxm) (4,3 KB) 
Put this is in ![grafik|234x96](upload://l7twIZsJ2oPAHbleJiySNSpb9pp.png)
3 Likes

Please check out the category guidelines for information on how to format a thread. What exactly are you looking for improvements on?

1 Like

On the movement being more precise

1 Like