R
robloxillian
Guest
I'm running into an issue where an if statement comparing two strings is returning false even though the strings are the same. Here is my code:
The string() cast is from my latest attempt, but the if statement also returns false without it. I've confirmed through breakpoints and print statements that the value w_key actually is "gun", in lowercase and with no spaces, but my code still doesn't enter the "if" block. I've tried = rather than == since some things I've read say that's necessary for string comparisons, but that didn't work either. Is there some other method I should be using to compare?
GML:
...
if (weapon_slot != noone) {
var w_key = weapon_slot.weapon_key;
if (string(w_key) == string("gun")) {
...