What do you want to achieve?: My gun hit registration is wack.
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.
Edit: Printed the CameraCFrame vs the MouseRay on both client and server. It somehow become different?
Client Left | Server Right