I'm trying to make it so you can grab a hat to place it on your player. I got it working, but if I don't use '->remove()' before setting a new hat, you have both on at the same time.
I know the reason behind the crash is that I'm trying to set a hat and if it's the first hat you pick, it removes a nothing hat (0 hats set, still tries removing)
I tried fixing this by doing
Code: Select all
if (MyHat != 0) {
MyHat->remove();
MyHat = 0;
}
So is there any way of detecting if it even CAN remove the hat, before trying to do so?