Raycasting Guns

Type OnHit(plr, hit) in your raycast section

It says unknown global plr and unknown global hit

Do you have a way to get the player that shot the gun?

Also put it after

local hitObjec, hitPos....
OnHit(plr, hitObject)

Could I use script.Parent.Parent to get who shot it

You should be firing a remoteevent from your localscript.

I have to go, but good luck. Here are some things you have to remember.

  1. Don’t rename the Humanoid
  2. TakeDamage can only be called on serverScript
  3. Use this link: RemoteEvent | Documentation - Roblox Creator Hub

wait why do you have to go right now nothing is working?

Don’t save your game, close out of it, and revert the version of the game. Read the posts I’ve sent up there, and try to figure it out. Sorry, I have to go, but I wish you the best of luck.