CloutBl0x
(cloutblox)
#1
My ignore list is not working and it’s giving me the error “Unable to cast value to Object”
Script:
local ignoreList = {}
table.insert(ignoreList, player.Character)
table.insert(ignoreList, workspace.Map.IgnoreThese:GetDescendants())
local ray = Ray.new(character.Head.Position, ((character.Head.CFrame + character.Head.CFrame.LookVector * 2) - character.Head.Position).Position.Unit)
local hit, pos = game.Workspace:FindPartOnRayWithIgnoreList(ray, ignoreList)
Med_App
(MedApp)
#2
GetDescendants
returns a table. What your code is doing is putting a table inside ignoreList
.
So to fix your issue I would do this:
local ignoreList = workspace.Map.IgnoreThese:GetDescendants()
table.insert(ignoreList, player.Character)
local ray = Ray.new(character.Head.Position, ((character.Head.CFrame + character.Head.CFrame.LookVector * 2) - character.Head.Position).Position.Unit)
local hit, pos = game.Workspace:FindPartOnRayWithIgnoreList(ray, ignoreList)