If statement condition returning instance

			local issamemodel = players:GetPlayerFromCharacter(v:FindFirstAncestorWhichIsA("Model")) == players:GetPlayerFromCharacter(script.Parent.Parent.Parent)
			local IsHumanoid = v:FindFirstAncestorWhichIsA("Model"):FindFirstChildWhichIsA("Humanoid")
			print( (issamemodel) and IsHumanoid)

My problem is that this always prints humanoid instead of true or false, how can i change that?

1 Like

Are you referring to the issamemodel variable? (I don’t know why but I thought that read “Itsamemodel”)

The humanoid is an instance, not a boolean value. It’ll print the name of the instance, therefore it outputs as “Humanoid”. If you need to have it as a boolean, use:

if IsHumanoid then
    IsHumanoid = true
else IsHumanoid = false
end
1 Like

issamemodel does return true, but when i add IsHumanoid it returns humanoid, shouldn’t it return true or false?

ok ok :shallow_pan_of_food: :shallow_pan_of_food:

It would always return Humanoid, but if used as a boolean variable, such as a if statement, it will be interpreted as true, as if an instance exists, it’s true, and vice versa.

That would be the case, but since you’re actually finding an object that’s an Instance & not of an actual property or conditional check, the Instance is being returned back (Or nil)

You could just reference it as a Bool value instead like @Doqee mentioned earlier

            local HumanoidCheck
			local issamemodel = players:GetPlayerFromCharacter(v:FindFirstAncestorWhichIsA("Model")) == players:GetPlayerFromCharacter(script.Parent.Parent.Parent)
			local IsHumanoid = v:FindFirstAncestorWhichIsA("Model"):FindFirstChildWhichIsA("Humanoid")
			print(issamemodel)

            if IsHumanoid then
                HumanoidCheck = true
            else
                HumanoidCheck = false
            end
            print(HumanoidCheck)
1 Like

yup that worked :shallow_pan_of_food: