So, I’m making a gun system and I’m using tweens to make the bullets move, Is there any better way to do so?
I’d say, a Linear Velocity, or any other forces/velocities.
How would I turn a Mouse Position into a vector velocity?
The bullet itself should only be for visual, the hit detection should 100% be handled by the server.
I wanna make everything my self. So if there is an issue i already know what is going on.
I should’ve suggested a Line Force, then it is way simpler. Just use a raycast from the mouse, place an invisible anchored part to the part the mouse is on, and put an attachment on the bullet and the part, then use the two attachments to move the bullet
Most games handle hit detections on the client then check if it’s valid on the server. I wouldn’t say it should be 100% handled by the server.
Problem with that is then for each bullet there is gonna be 2 parts.
Then, I would just put the attachment in the part that the mouse is on at the position of the mouse
Nvm im gonna go with the first thing you said.
Remember to delete the attachment when it hits. (but that’s obvious)
dont have a lot of time so i write quick
Its good you use tweens, don’t render it with physics it can become very laggy. My suggestion is render the projectile on the client, what my system does is whenever I fire a bullet on client, it will send that to the server, like the position of fire, and the fire direction etc, but the server will only save that data for now and replicate that you fired a bullet to the clients nearby, but it will not render the projectile itself. And then you render the projectile on the client, and if the client renders a hit, it will replicate that the bullet hit and pass the ID of the bullet, I use UUID to give the bullets ID’s. Then the server will render the projectile instantly and check if that collision was true. It is good to not specifically check if the bullet hit the same location on the server, but rather if it was very close to hiting same location, and the location the bullet hit on the server was close. Another I thing I do is when rendering projectile, i make it tween 5 studs forwards or something like that, then it direction drops down a little to simulate bullet drop. I use raycast to create the bullet.
Sorry if this was a little complicated hahaha, but just try to make the system in a way you understand it, no need for bullet drop etc if thats to complicated. I wish you the best of lucks making your system, lmk if you need any more hlep etc
I’m not gonna do bullet drop lol.
So, what I got from that was I want to make it so every few seconds the bullet ray casts forward, If It hits a player then damage them if a wall then destroy if nothing then keep going?