So recently I have been trying to check if an attribute is equal to a value but it’s not working here is my if statement:
if pet:GetAttribute('PetNum') == 1 then
print('Yes')
end
But it does not pring ‘Yes’. How do I fix this?
Thank you!
So recently I have been trying to check if an attribute is equal to a value but it’s not working here is my if statement:
if pet:GetAttribute('PetNum') == 1 then
print('Yes')
end
But it does not pring ‘Yes’. How do I fix this?
Thank you!
It could be that PetNum is not one, try printing the attribute’s value before the condition
print(pet:GetAttribute("PetNum"))
if pet:GetAttribute('PetNum') == 1 then
print('Yes')
end
Everything is correct here, so the only explanation is that the attribute doesn’t exist, or at least when the code is executed.
Oops, that was my bad I spelled it PetNum instead of PetNumber .
What about putting pet:GetAttribute("PetNum")
into a variable, and then checking the variable?
I doubt that’d change anything.
True. I mean, sometimes it could somehow work.
It’s okay haha, sometimes we all make mistakes when naming things, hell sometimes I can forgot to put .Value
, but in the end it’s all fixed! If you have anymore issues don’t be afraid to make another post!