Am I doing anything wrong with raycasting here or is it a seperate issue
function module.PlrFire(source : StartingPlaceOfTheRay, angle, plr)
local param = RaycastParams.new()
param.FilterType = Enum.RaycastFilterType.Blacklist
local no = {}
for _,child in pairs(plr.Character:GetChildren()) do
if child:IsA("BasePart") then
no[#no + 1] = child
end
end
param.FilterDescendantsInstances = no
local result = workspace:Raycast(source, angle, param)
if result ~= nil then
local part = Instance.new("Part", workspace)
part.Position = result.Position
else
print("wow nothing?")
end
end
1 Like
No you’re doing everything correctly trust me
1 Like
You can just set the Filter to the Character.
param.FilterDescendantsInstances = {plr.Character}
1 Like
that put out an error when I tried it
function raycast(origin, direction, distance)
local rayIgnoreList = {rayFolder}
if not distance then
distance = 300
end
local raycastParams = RaycastParams.new()
raycastParams.FilterDescendantsInstances = rayIgnoreList
local result = workspace:Raycast(origin, (direction - origin).Unit*distance, raycastParams)
local intersection = result and result.Position or origin + (direction-origin).Unit*distance
return intersection, result
end
function rayModule.CastRay(origin, direction, distance)
local intersection, result = raycast(origin, direction, distance)
return intersection, result
end
``