I’ve got a gun that works while testing, but not with other people for some reason. The error comes in the humanoid variable. Anyone able to help?
local tool = script.Parent
local user
local Ignore = {player.Character, tool}--Ignoring the player's character and the tool
local ray = Ray.new(tool.Handle.CFrame.p, (mousePos - tool.Handle.CFrame.p).unit*300)
local hit, position = game.Workspace:FindPartOnRayWithIgnoreList(ray, Ignore)--Putting the table in the ray
local humanoid = hit.Parent:FindFirstChild("Humanoid") or hit.Parent.Parent:FindFirstChild("Humanoid")
Yeah it has to be both a localscript and script. You need a remoteevent that gets the mouse of the player using the gun and damage the target (if it finds a humanoid) in the script.