Hitscan Gun Hit-Regristration Problems

  1. What do you want to achieve?: My gun hit registration is wack.

  2. What is the issue?: So, I fire a dummy raycast on the client for instant feedback.
    (Effects are done on client if the raycast hits)
    if it hits then I fire an event over to the server

		local Client_Hit_Scan = Raycast(Player,Tool,CameraFrame.Position,MouseRay.Direction * 1000)
								if Client_Hit_Scan then
									Gun_Event:FireServer(Tool,CameraFrame,MouseRay)

Which passes it into a Handler script, which checks for if it has ammo and other security checks.
if it passes, then it passes the data into a module. (This module also replicates the effects to everyone else)

GunModule.Default_Fire_V2(Gun,Player,CameraCFrame,MouseRay)
if GunModule.Reloading_Table[Player.Name] == true then return end
	if not GunModule.Gun_Table[Gun.Name] then return end
	local Character = Player.Character
	local GunType = Gun.Name	
	local Settings = GunModule.Gun_Table[GunType]
	local Ammo = GunModule.CheckAmmo(Gun)
	Gun:SetAttribute("Ammo",Ammo - 1)
	local Hit_Scan = GunModule.Raycast(Player,Gun,CameraCFrame.Position,MouseRay.Direction * Settings.Range)

problem is, this Hit_Scan will not be the same as the one on client(even though they have the same values?)
3. What solutions have you tried so far? I cant seem to find anything wrong.
https://gyazo.com/9600822e14b838f8159fb9f587f6b59d
Edit: Printed the CameraCFrame vs the MouseRay on both client and server. It somehow become different?
Client Left | Server Right
https://i.gyazo.com/56e595da5a4c45585037167b76d2d5c7.png

Also, I know

GunModule.Default_Fire_V2(Gun,Player,CameraCFrame,MouseRay)

should look like

GunModule.Default_Fire_V2(Player,Gun,CameraCFrame,MouseRay)

but I know thats not the solution, its just that it passes through handler in that order.

bumping this because no solutions

I really don’t get what the issue is, please elaborate.

Alright so, you passed the MouseRay parameter even though you wanted to send the MouseRay.Direction * 1000 parameter.

I don’t know if this is the proper reason of it not having the same values but I hope this helped!

SwedishRaptor

Should have clarified, my bad.
The * 1000 is just a placeholder for the client’s ray. The actual length is done on the Server Module