I have a gun that uses Raycasting but I'm not sure how to actually make it filtering. I've tried to but when I reference the Gun's handle in one of the arguments for FireServer() the output gave error that just said Handle is not a valid member of Player
Is there any other way I could make the gun tool filtering? Or is there any way to bypass this error.
If you would like to see my scripts, here is the script that is on the server-side.
local function GunRemoteFired(tool, Calcuation, Character)
local ray = Ray.new(tool.BulletFire.CFrame.p, Calcuation)
local part, position = game.Workspace:FindPartOnRay(ray, Character, false, true)
local beam = Instance.new("Part", workspace)
beam.BrickColor = BrickColor.new("New Yeller")
beam.FormFactor = "Custom"
beam.Material = "Neon"
beam.Transparency = 0.25
beam.Anchored = true
beam.Locked = true
beam.CanCollide = false
local distance = (tool.BulletFire.CFrame.p - position).magnitude
beam.Size = Vector3.new(0.3, 0.3, distance)
beam.CFrame = CFrame.new(tool.BulletFire.CFrame.p, position) * CFrame.new(0, 0, -distance / 2)
game:GetService("Debris"):AddItem(beam, 0.16)
if part then
local humanoid = part.Parent:FindFirstChild("Humanoid")
local player
if not humanoid then
humanoid = part.Parent.Parent:FindFirstChild("Humanoid")
end
if humanoid then
player = game.Players:GetPlayerFromCharacter(part.Parent)
if player.Team == game.Teams.Zombies then
humanoid:TakeDamage(35)
end
end
end
end
Here is the cilent-side script.
local function Shoot()
if debounce > 0 and IsActive and player.Character.Humanoid.Health > 0 and player.Team == game.Teams.Survivors then
RemoteEvent:FireServer(tool.Handle, (Mouse.Hit.p - tool.Handle.BulletFire.CFrame.p).unit * 300, player.Character)
debounce = debounce - 1
GunGUI.TextLabel.Text = preSetStringGuiText..debounce.." / "..maxAmmo
elseif debounce == 0 then
ReloadSound:Play()
mouseEvent:Disconnect()
ReloadAnimation:Play()
GunGUI.TextLabel.Text = preSetStringGuiTextReload
for i = 1, 3 do
GunGUI.TextLabel.Text = GunGUI.TextLabel.Text.."."
wait(reloadTime / 3)
end
mouseEvent = Mouse.Button1Down:Connect(Shoot)
debounce = maxAmmo
GunGUI.TextLabel.Text = preSetStringGuiText..debounce.." / "..maxAmmo
end
end
--debounce is basically just a numbered value that resets if it is 0.
Thanks for viewing this!

2 comments
Just because you indexed an invalid property while calling a method doesn't mean you should find a new method. You should post the whole script so people can better help you.
Edited it