Making a sports game swing

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    i want a clean swing that is easy to hit the ball
  2. What is the issue? Include screenshots / videos if possible!
    i cant find anything on how sports games make their swing
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    ive looked on google and youtube and havent found nothing
    After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
-- i have no code because this is more asking for resources that i cant find
1 Like

Just bumping this sorry its been a while

1 Like

What do you mean by “swinging”? Like baseball?

1 Like

Like you have a tenis ball, you take your racket and swing it… how do sports game make that swing happen…

1 Like

Oh like tennis (next time specify that please, swinging could mean anything. My first thought for some reason was spiderman :0)

Im can lay it out to you how you are gonna do this.
One you’re gonna need to make an animation and anytime you want the player to swing play the animation, while you are swinging use workspace:GetPartsBoundInBox, if it returns the ball then you take the ball an apply some velocity to it to hit it to the other side.
Thats the simple version of it

1 Like

yes, it not the animation playing that hits the ball. its likely a hitbox that detects if there is a ball inside the hitbox when you press the button to swing.

1 Like

I’ve got a guide that covers the basics of making hitboxes, though it might be a bit advanced for you, no offense. Though instead of the traditional interval check, you might want to only do a check once the ball is close to a player. The method you should use really depends on the sport, like in golf you shouldn’t really use hitboxes at all.

1 Like