The Best Method to Create Soccer Kicking System/Dribbling System?

So I am currently working on a soccer game and i actually created a kicking/dribbling system using a hitbox method but it actually not working as i expected, so thought of rebuilding it from scratch and would like to know the best method if someone could explain me :slightly_smiling_face:

The last script, i had a problem where when i turn around quickly and try to kick the ball goes in the wrong direction, i dont know it this is because of my ping / the custom shift lock i made or my calculation problem! what i did was when the ball touches the ring of the bottom of the player, and then when the player clicks left mouse button, the ball gets velocity added on the direction the character’s humanoid rp

hers the video of the problem of my last soccer script:


would like to know if someone could help :slight_smile:


I have to assume you are making the velocity changes to the ball through a RemoteFunction/RemoteEvent (Telling the server to make x change.), so ping could be a factor, but hard to tell. Does it behave that way in studio?


yep that’s the way we are doing

1 Like

yep, that’s the behavior in the studio too! we are just firing the event to the server when it touches and click left mouse button


so do you have any fix for this?


I put something together in about two hours or so and I don’t think I am having that issue with this provided the lookvector of the humanoid rp Cframe isn’t used. However, I’d say what I put together is very basic and probably far from perfect compared to what you wish to accomplish.

Ended up using the MoveDirection for the Humanoid instead of the Humanoid RP CFrame Look Vector and as said above didn’t experience anything with that. My guess is that it ends up applying the velocity when the Character hasn’t fully turned around resulting in the ball going off in a direction the player is no longer looking. You could possibly add a delay but that would probably make things worse gameplay wise, not really sure of another solution other than MoveDirection and possibly checking if the player is still in the process of changing directions.

Video Using MoveDirection:

Video Using Humanoid RP LookVector:

I went ahead and included a place file for you to look at, tried to comment some of the code as well.
BallExample.rbxl (33.9 KB)

1 Like

Thanks for the help, i will surely check it out and reply you with the results :smiley:


Use blockcast instead of a circular hitbox.

workspace:BlockCast(hrp.CFrame *,-2,0), hrp.Size, hrp.CFrame.LookVector * 2, params)

@bluebxrrybot @helperobc Thanks both of you! It Finally worked out using Blockcast and MoveDirection :smiley:


Also a last question, is there any other way than look vector to calculate direction when they are not moving, I know move direction will only be calculated when they are moving, so wondering if possible :slight_smile:


because look vector doesnt give the correct direction they are facing sometimes


Not really sure, in theory if you click and aren’t in the process of rotating (as well as are not planning to rotate) your character you can use Look vector, otherwise if the character is on the move and is in the process of switching directions, you’d want to use Move Direction. You could try adding in some if statements to check this (basically if Move Direction is zero apply instead via look vector.) and make changes accordingly to see how that works out. As I said above my solution I gave (seems at least to me) is pretty basic.

The whole reason it goes in different direction appears to be because the character is still in the process of changing looking directions when the mouse is clicked and as such MD is a better solution if that’s the case.

1 Like

when the player is not moving, i use look vector and when moving I use md but the problem still when the user walks and then suddenly stops and then rotates quicker and click the mouse button, it goes in the wrong direction m finding a way to fix


Could possibly use AssemblyAngularVelocity on the Y access to determine if they have stopped rotating. Issue is that it takes time for it to cool down to 0 even after you stop rotating and it can be a negative number, My observed behavior is that if it goes positive and you stop moving it slowly works it way down to zero, I’d assume it’s opposite if it goes negative.

Likewise (perhaps using a coroutine?) you could get the Humanoid Root Part Rotation and compare over a small period of time to see if it’s changing or staying the same, how much time (obv in ms) idk.

Both of these solutions I’ve offered to that stationary rotation issue is hacky at best imo.

Just making sure you are using an if statement first to see if any values of movedirection are not zero before using humanoid root part look vector, right?

Might want to consider unmarking the solution to see if you can get more eyes on this post as well as updating the Original (or creating a new reply with these and then linking to that at the top) post with the changes you made and the new issue you are experince, that or create a new post, but considering it’s still around the same topic and similar issue I don’t think that it would be necessary or called for. Starting to run out of ideas at this point.

Also including some code snippets if you are comfortable doing so might be helpful for everyone trying to help out.


Also Sometimes the MoveDirection gives me a vector of 0, 0, 0 even when am moving. Any idea why it is like that?

local RS = game:GetService("RunService")
local ball = script.Parent
local m1Event = game.ReplicatedStorage.RemoteEvents:FindFirstChild("MouseButton1Event")

local defaultForce = ball:GetAttribute("Force")
local force = defaultForce

local hitObject = nil
local db = true

function OnTouchFootball(hit)
	if hit.Name ~= "HitBox" then return end
	hitObject = hit

function OnTouchEndedFootball(hit)
	if hit.Name == "HitBox" then
		hitObject = nil


function M1Event(player,Ring,db,holding)
	if hitObject then
		ball:SetAttribute("Force", 27)
		local character = hitObject.Parent
		local ring = character:FindFirstChild("Ring")
		local isDribbling = ring:GetAttribute("IsDribbling")
		local camY = ring:GetAttribute("CameraY")
		local camLV = ring:GetAttribute("Camera")
		local YVector

		if camY <= 11 then
			YVector = 0.3
			force = defaultForce * 1.6
		elseif camY >= 12 then
			YVector = 1.8
			force = defaultForce * 1.8
		local humanoid = character:FindFirstChild("Humanoid")
		local humanoidRootPart = humanoid.RootPart
		local direction

		ball.AssemblyLinearVelocity =,0,0)
		ball.AssemblyAngularVelocity =,0,0)
		direction = (humanoid.MoveDirection) +,YVector,0)

		ball:ApplyImpulse((direction * force) * ball.AssemblyMass)




1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.