Leave + Rejoin = Badge

Hello Everyone. I’m currently making a script that gives you a badge if you leave and rejoin a game, you will get a badge. Here is what I have so far.

  1. I added a RemoteEvent under ReplicatedStorage
  2. I renamed the RemoteEvent to LeaveRejoinEvent
local LeaveRejoinEvent = game.ReplicatedStorage.LeaveRejoinEvent
local BadgeService = game:GetService("BadgeService")

local BadgeId = 0 --Insert your BadgeId here

I don’t know what else to do.
Any help will be appreciated!

2 Likes

You could store the player’s userid into a datastore if there is no data about the player yet and then when the player joins and the data is set to something new then they will be awarded a badge. Then you can set that data to something else so it wont try giving you another badge again.

1 Like

Like @alliedoeihoialt mentioned, you could save data that they were there. Depending on your use case you could use either MemoryStoreService or DataStoreService. Personally I’d utilize memory store service, as it would be more reliable. If you want to store it long-term though, use data store service.

3 Likes

@alliedoeihoialt @BuilderBob25620
Thanks for telling me this. I did not know about the MemoryStoreService until you guys came.

If you are just now learning it, I’d recommend looking at these articles, as data stores and by association, memory stores can be difficult to learn at first. If done improperly, you can end up having data loss.

Articles:

1 Like