How to make players control a soccer ball?

So I’m trying to create a system where if a player touches the soccer ball, they have control over it and it follows their movement. However, if another player bumps into the soccer ball, the soccer ball is then controlled by other player and follows their movement.

Any ideas on how to go about this?

I’ve tried using a child of the player’s character for the soccer ball to follow, and update it using Heartbeat but it just has a spasm. Thanks, much appreciated.

Best try would be using custom controller like when plaer press “W” add forward velocity to the ball. and similarly for others

maybe you can try to weld the ball infront of the player

1 Like

@Beastcraft_Gaming. I understand how to do the UserInput side of it, but is there any formula in particular that I could used for velocity?

@BeyondTheEgde Welds may work, hmmm.

This is a choppy area, because, it’s always going to be unreliable in terms of server-client replication. I suggest personally, you move it a distance in front of the player’s torso with influence on their current velocity, to make it smoother if the player is lagging- sudden turns would lag a little more but people arent going to snatch the ball from 10 meters behind you. You do have to be careful though, that if you’re doing it based on velocity to compensate for lag, otherwise people who arent lagging at all will find it fly out of their reach.

You could have an alternative method which requires the player to send it in a direction instead of it just following them, which really reduces the effort you have to put in, to replicate it.

1 Like

You may find bodyposition or alignposition useful for this, just make them change based on the player’s root.

1 Like

Hmm, well for velocity it’s seem to go out of reach. Also when the player moves around, e.g to the left, the ball follows to the left even if it’s 5 metres away. Velocity can work, but I need it to be like right infront of the player.

I was thinking about this, but then that kinda defeats the point of being able to control the ball. For example once you’ve touched it, the ball goes in front of you and you control it, as you are moving. Unfortunately I have to restart because I was dumb enough to use a while true do without a wait(). Smh. I think a better alternative is heartbeat.

@jcnruad900 I’ll take your suggestion and see what I can do. Thanks.