Ok so I am having issues with a certain syntax error in my game. The error message is something along the lines of "unable to cast value to object(s)". I am trying to run a ray cast for a weapons system but cant seem to figure out the error. Also whenever remove the parameter it just returns either a part of my character or part of the gun (which is parented to the character model btw). The code is as follows:
-- instances
RE = game.ReplicatedStorage.FireTrigger
--functions
local function Cast(Player, Origin, Target)
local params = RaycastParams.new()
params.FilterDescendantsInstances = workspace:FindFirstChild(Player.Name)
params.FilterType = Enum.RaycastFilterType.Blacklist
local ray = workspace:Raycast(Origin, Target - Origin, params) --just so you know the things in hte local script are correct i know the problem is in this script
print(ray)
end
--connect functions
RE.OnServerEvent:Connect(function(Player, Origin, Target)
Cast(Player, Origin, Target)
end)
the issue is on line 6 where i define what is blacklisted. if anyone know how to fix it and avoid it in the future i would appreciate to get help!
