Ball Rolling Forward

So i have a ball socket constraint connected between a player and a ball (Both are plrs) The ball should roll infront of the player. The ball just has to roll forward infront of the plr, Here is my code:

game.ReplicatedStorage.BoulderEvent.OnServerEvent:Connect(function(Plr, F)
	local Kill = false
	local Tmate = nil
	for i,v in pairs(Plr:GetTags()) do
		if game.Players:FindFirstChild(v) then
			Tmate = game.Players:FindFirstChild(v)
		end
	end
	
	local plrRoot = Plr.Character:FindFirstChild("HumanoidRootPart")
	local tmateRoot = Tmate.Character:FindFirstChild("HumanoidRootPart")
	
	if Tmate:IsA("Player") then
	if F == "Roll" then

			local Part = Instance.new("Part")
			Part.Name = "ReferencePart"
			Part.Parent = tmateRoot
			Part.Position = tmateRoot.Position
			Part.Transparency = 1
			Part.CanCollide = false
			Part.Massless = true
			
			local Weld = Instance.new("WeldConstraint")
			Weld.Name = "RidgedWeld"
			Weld.Parent = plrRoot
			Weld.Part0 = plrRoot
			Weld.Part1 = tmateRoot
			
			tmateRoot.Position = Vector3.new(3,0,3) * plrRoot.CFrame.LookVector + plrRoot.Position - Vector3.new(0,0.9,0)
			
			local plrAttachment = Instance.new("Attachment")
			plrAttachment.Name = "RigidAttachment"
			plrAttachment.Parent = Part

			local tmateAttachment = Instance.new("Attachment")
			tmateAttachment.Name = "RotatingAttachment"
			tmateAttachment.Parent = tmateRoot

			local ballSocket = Instance.new("BallSocketConstraint")
			ballSocket.Name = "BallSocketConstraint"
			ballSocket.Attachment0 = plrAttachment
			ballSocket.Attachment1 = tmateAttachment
			ballSocket.Parent = plrRoot
		
			tmateRoot.Massless = true
			
			local TweenService = game:GetService("TweenService")
			local tweenInfo = TweenInfo.new(0.01, Enum.EasingStyle.Linear, Enum.EasingDirection.Out)
			local lastPosition = tmateRoot.Position
		repeat
				local Speed = (tmateRoot.Position - lastPosition).Magnitude * 10
				-- Add spin here
		until Kill
		
	else
		Kill = true
	end

Thanks for any help!

1 Like

And what’s the issue? We are here to help you solve issues, but you still need to do your due dilligence to figure out roughly what line is having the issue and why so we can help you effectively.

1 Like

Ive done some looking and figured out im kinda stupid and the vector moves forward accordingly, now im here

local lastPosition = tmateRoot.Position
			repeat
				lastPosition = tmateRoot.Position
				tmateRoot.Orientation = tmateRoot.Orientation + Vector3.new(-20,0,0)	
				task.wait(0.01)
			until Kill

The orientation doesend add it just sets it to the bottom and moves back and forth slowly

1 Like

Basically the ball rotates forward like the player is pushing it