Need help with gun

Yes just have the client render it instantly then fire a remote event to other clients to render the bullet as well. That is what all shooter games with smooth projectile movement do on roblox.

Wouldn’t that make the bullet exploitable?

How would that make it exploitable?

Someone above commented that spawning the bullet from a local script will allow it to be exploited.

That will not make it exploitable?

But if it is rendered by the clients then how can I fix my other problems of the bullet not being able to detect a hit and setting the network owner.

Thought the bullet got shot from a regular script and remote fired from a local

Use raycasting for detecting a hit

I normally do client side hit detection with a lot of sanity checks on the server.

https://developer.roblox.com/en-us/articles/Raycasting

30 chars

Think of it as this the bullet goes infront of the mouse so the vector3 goes into a straight line you can use magnitude or distance for that

I’ve already tried Raycasting but I found it to be inaccurate a lot of the time, especially when my character is moving.

Raycasting is the most accurate solution for making guns, this is why its best if you do it on the client. You could also use bullet magnetism for making shooting easier, it means you basically weld a bigger hitbox to the character.

Search raycasting gun find a new one that has robloxs updated raycast in the toolbox and learn from it

I think what I’ll do is when I click the mouse it renders a bullet on the client and at the same time casts out a ray. I can calculate how far away the target is and use that to know when the bullet should destroy itself. Giving the effect that it was hit by the bullet. How does that sound?

I learned how to make pistols a couple months ago from it

The only issue with that is players won’t be able to dodge the bullets, but if your making fast bullets that will be ok.

Ok thank you I’ll let you know how it works out.

1 Like

This will likely help you:

I finished it and it looks nice, I changed it up a bit so it takes the distance of the player and the distance of the moving bullet. Once the bullet’s distance is greater than the target than it deletes, making it look like it hit the target.