Why is studio ignoring my code?

Yeah so it’s 2:32 AM and I’m apparently trying to work a miracle here.
For whatever reason, studio refuses to jump into this line of code, I made the If statement as bland as possible and it just won’t run.

if plr.Name == "Recallity" or plr.UserId == 19163567 then
   print(plr:GetRankInGroup(3600159))
   print(Points.Value)
   print("Promoting "..plr.Name)
   Http:PostAsync("https://#########.herokuapp.com/promote/3600159/"..plr.UserId.."/",{})
end

I’m joining on my alt ‘Recallity’ and it’s not working for some odd reason, the code in front of it and the code behind it are working just fine no errors, nothing

I’ve adjusted the if statement at least 10 times to try different ways

For the sake of context, here’s the rest of the block it belongs to: https://pastebin.com/88J4BbWR

If you find it in the paste bin, the “Points” above it does print out, and it does change the points leaderstat value

Also on one of the last tests, I got this error locally. (not on the server side where this code is located)
image
I don’t think its relevant though

UPDATE: So if I delete the Http:PostAsync the if statement goes through, but if I re-add it, it voids every change I’ve made to the script after I’ve re-added it.’

Also please read all the replies before you post a suggestion.

So print(Points.Value) works? I assume the “Promoting” part too? It’s just the Http:PostAsync() that’s refusing to work?

also, the plr variable will always be the player. check plr.Parent to see if he/she left

also might want to edit the script so you’re not publically sharing your unprotected API

No, it doesn’t even enter that if statement.

If you look on the Pastebin on line 31 right before the if statement it successfully prints out “Points” but stops there.

What’s line 32 about?

the ‘—’ is there as a spacer.

Just in case, under the print("Points"), add a print(plr.Name)

plr ~= nil should always be true, and I think wait() still returns a value, so the only remaining thing that could stop it from reaching the if-statement is the player’s name.

I just did, the player name prints out correctly.

I changed the if statement to if Points.Value > 4000 then, still no luck.

And yeah I noticed that a while ago but I wasn’t sure, I changed it to plr.Parent

Only thing that I can think off now is that print(plr:GetRankInGroup(3600159)) yields forever (or at least long enough to trick you). Does it still update the points every 10s, or just once after joining?

Still updates points and everything runs fine. I just don’t get why the if won’t go through.

Juuuust in case, add print(plr.Name == "Recallity") after the Points-print. Otherwise… get an excorcist?

and copy that condition directly from the if-statement, in case it contains invisible characters somehow

I guess I’ll call an exorcist then, got any recommendations?

Maybe if I set this to studio bugs then one will find me?

Can you try on a live game?

Could try checking UserId instead I guess

That’s what I’ve been doing.

Found a possible issue. You’re passing a table to HttpService but I’m fairly sure that the post body needs to be a string. Try fixing that.

Just changed it to a string, still nothing.

1 Like

Changed it to if plr.UserId ==

Still nothing.

Does the If statement run if you remove the Http:PostAsync request?

FYI if plr ~= nil will never fail. It exists since you still reference it. Instead, use if plr.Parent ~= nil. That won’t solve your problem, but wanted to throw that out real quick.

If you read the other replys I already changed it to plr.Parent, thanks
though.

1 Like