[No idea...]Raycasting Laser

I am fairly new to raycasting
A few days ago I decided I wanted to make an attachment for a weapon, and I began working on my laser attachment. However I’ve run into a problem that I can’t seem to fix!


as you can see there is a delay when the laser comes in contact with an object

I guess my question is…

  • Do you know if there is a way to (if possible) instantly have the laser hit when it comes into contact with an object?

Usually, the best answer for making things instantly appear is to just generate the laser in a local script instead of a server script, and this is acceptable because the laser is only a cosmetic.

There shouldn’t really be anything in the code to change either, if you are basing it just on the CFrame of the character’s weapon.

5 Likes

This is due to replication from the client to server taking time. It is not instantanious. Try creating the laser on the client, and check for exploits/ validity on the server.

Server delay make the ray effects on the client and then make the actual ray checking on the server. This will end up solving your issue this ends up due to ping as you have to communicate back and fourth between the server.

hi guys im from the future:just use heartbeat or renderstepped i hope this should work

1 Like