Hello, I’m having an issue with the return value of :IsDescendantOf().
When I use the function, it doesn’t allow me to do anything with it and constantly returns something that it clearly shouldn’t be
bottle is an instance and works fine, the only issue is :IsDescendantOf()
-- ERROR --
01:43:35.686 Workspace.SlimeGirlSpecialist.The New Fresh.Main:194: attempt to index boolean with 'IsDescendantOf' - Client - Main:194
-- CODE --
bottle.Handle.Touched:Connect(function(hit)
remotes.DestroyBottle:FireServer({bottle})
hit = true
local target
for i, v in ipairs(game.Players:GetPlayers()) do
print(hit:IsDescendantOf(v.Character)) -- ERROR HERE
if hit:IsDescendantOf(v.Character) then target = v end
end
for i, v in ipairs(workspace.Dummies:GetChildren()) do
if hit:IsDescendantOf(v) then target = v end
end
if target == client or target == char then return end
remotes.Damage3:FireServer({target,hit})
end)
I’m using it in the exact same way as shown on the API reference, yet I get the same error
print(hit:IsDescendantOf(v.Character))