Is there any way I can create instances on the server without the instances being replicated to clients? I am trying to create a gun system whereby every shot claimed to have hit on a client, must be validated by the server by “rewinding” time to check if it was indeed possible to have hit a certain object at a certain time.
Well yes, but actually no, Firstly when you add it in the server fire a remote event to all clients from the server and destroy that instance.
Yea, that’s not very ideal. It would be desirable to not have had the instance replicate in the first place to reduce network usage.
Well, I don’t think there is any other way to do it.
If your goal here is to make a gun system with no lag and not exploitable, your best bet would be to detect the
MouseButtonDown and fire a remote to the server, then calculate the cool down and validation of the shot being fired on the server, then if the checks have been successful, from the server fire a remote to all clients using
Remote:FireAllClients() and do the projectile physics/ray-casting on the client side.
This is exactly what I am attempting to achieve. However, to validate the shot on the server I want to “rewind” time, which would entail recreating the map as was seen by the client at the time of a successful shot. Then the server would perform raycast checks to see if it was indeed possible for the shot to have occured. My question lies within the recreation of the map. I would only have to recreate objects that have the ability to move, such as characters. I need a way of creating instances on the server without them being replicated to clients as no doubt many hundreds of these rewinds would cause network issues.
Why not just do the checks first before you fire the bullet? Why do you want to wait for the bullet to have already been fired and then “rewind time” to check if the bullet was fired legally?
Just do the checks before the bullet has even been fired.
Never trust a client to perform the checks.
Reread the entire post I wrote above…
Your method does not guarantee that both the server and client would reach the same conclusion of what was hit.
Rewinding back to the client’s perspective is used among many fps games outside of roblox. When the server gets the shoot event, it rewinds all of the objects based on the client latency. It definitely is possible on roblox, im not sure how, but @MrChickenRocket implemented this with his custom humanoid, “chickynoid”
Creating a Part in the Server’s Camera object will not replicate to any Clients.
The server cannot see the clients perspective.
As i said, based on the latency, the server can position the objects through a saved table or something similar.
Yup, check out how its done here:
Can you not use instances parented to ‘nil’?