Roblox still giving badge even when script is deleted

the code:

while true do
    local badgeId = 2124743111
    for _, player in pairs(game.Players:GetPlayers()) do 
		game:GetService("BadgeService"):AwardBadge(player.userId, badgeId)
	end
	wait(3) 
end

the badge keeps on being given out even when the script is deleted.

I clone the map from server storage, put it into workspace, after it is done, I delete the clone. (this is all serverside). This script is server sided

I own an elevator meme game, called The Meme Rv, and the problem with this is after map plays in a server that has a badge anyone else who joins that server and didnt see it, gets the badge.

I don’t see why you have to use the while true do loop if you just want to award the badge once when something happens. Deleting the script should’ve stopped it, the only reason I see it not stopping is if you deleted it locally, and moving it to ServerStorage should’ve stopped it as well, and once again the only reason I see why not is if you moved it locally. In this case it’s much more convenient to just remove the while loop.

I want the badge to be awarded to everyone who sees the map, and some people might join after the badge has been awarded, maps typically last 30-80 seconds. I clone the map from server storage, put it into workspace, after it is done, I delete the clone. (this is all serverside)

I’m not here to tell someone how they should be making their game, but why don’t you just award the badge at the end when the map leaves? Anyways, check if the scripts you used to delete/move the script are local, because if they are, then that is most likely what’s causing the problem here.

I already said, I clone the map from server storage, put it into workspace, after it is done, I delete the clone. (this is all serverside). Im not stupid enough to make my games main script local sided

image

Is the script that calls for Destroy() a local script? I think that will only destroy the script client side. You might have to fire a remote event with it to get it to destroy a server script.

as I said before in a previous comment. I clone the map from server storage, put it into workspace, after it is done, I delete the clone. (this is all serverside). Im not stupid enough to make my games main script local sided

I think this is a roblox bug. That they really need to fix.

Are you sure there is no other script doing it?

It can’t be a Roblox bug since Roblox only awards badges when you want them to.

the badge script is in the map it itself which gets deleted by a server script.

Does the map get destroyed and then keeps awarding?

yes, thats what is happening. I dont know why tho

Using :Destroy() doesn’t stop while true dos.

It definitely does, destroying the script or the script’s parent stops the loop when I tested it. I have no idea why it doesn’t work for OP but it’s definitely not a Roblox problem.

Okay, here a few possible problems:

  • Badges never can be revoked.
  • There is a delay for badges getting awarded.
  • Another script may exist elsewhere.
  • The script may be reparented.

What? I have done this and it works…

Well, I am even running my game in studio and the cloned map does get destroyed with the script in it, server side destroyed.

Did you shut down the servers?