How do I code a dodgeball?

I have been trying for hours now to make a dodge ball which can be picked up and threw at players, and when a player is hit they become invisible and no collided. I have again like I said been trying for hours I have looked at youtube tutorials but can not get it to work. If possible please give me a script which would at least make the dodge ball be able to be picked up and threw and also if possible the action caused when they are hit.

In advance thanks, all scripts I tried also I have deleted.

People are not going to do all the work for you. We can help you but not do all the work for you.

If you don’t know where to start, I would recommend you to look at the VectorForce Instance.

If you have more specific questions, you can ask them.

3 Likes

Ik they can’t do all the work for me I just need a basic understanding on how to do it.

Where is your problem exactly? Listening to player input? throwing the ball? Please be more specific. Also, what have you tried yet?

1 Like

What part of the dodgeball are you stuck on?

The moving, the stunning, or the picking up?

Use something like a VectorForce for the throwing, a tool that can be picked up for the picking up and perhaps force the player to sit using Humanoid.Sit for the stunning.

1 Like

I have managed to do throwing its now picking up the dodgeball.

There are several ways you could do this, one way you could do this is through the use of VectorForces as @rstkdev stated; to check if a play has been hit, you could use the event Touched or, you could cast rays.

Another way would be through the use of kinematic equations, these will require a little bit of knowledge about physics but, it’ll give you more control over the ball and, you won’t really have to use the event Touched.

If you want a player to be able to pick up the ball, just use a touched event and, a server sided sanity check to make sure the player has actually touched the ball.

I recommend reading this PSA: Using TouchEvents Properly!
Also, touched events are handled on the client so, always do some sort of server sided checks to make sure an exploiter hasn’t teleported a ball to their character or, if they’ve disabled the connection so it doesn’t fire if they’re hit, therefore, I’d advise against using touched events to check if a player has been hit, instead, casting rays is much better.

2 Likes