I’m trying to figure out how I can run it visually on the client but have features of a remote event gun.
Putting it on the client makes it exploitable.
So is there a way I can run it on the client for visuals while the actual bullet is ran by the server?
I guess you can put a localscript in the gun and in serverscriptservice the bullet
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.
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