Image not changing

I wanted to make an image change with a LocalScript, but it doesn’t show

SCRIPT:

label.Badge.Image = game.Players:GetChildren()[i].Data.Badge.Value

I’m assuming Player.Data.Badge.Value is equal to a BadgeId. This should work if my assumptions are correct. If another person is willing, they can explain it to you.

local imageId = game:GetService("BadgeService"):GetBadgeInfoAsync(game.Players:GetChildren()[i].Data.Badge.Value).IconImageId
label.Badge.Image = "rbxassetid://"..imageId

The value is actually: rbxassetid://(id)

Can you show me the script that sets the value, or is it set by default?

Wait, I just understood what you said
SCRIPT:

Players.PlayerAdded:Connect(function(Player)
	local BadgeKey = "Badge-" .. Player.UserId
	local BadgeData = datastore:GetDataStore("Badges")
	local GrabbedData = BadgeData:GetAsync(BadgeKey)
	local Extension = "rbxassetid://"
	if GrabbedData then
		Player.Data.Badge.Value = GrabbedData
	else
		BadgeData:SetAsync(BadgeKey, Extension .. "0")
		Player.Data.Badge.Value = Extension .. "0"
	end
	BadgeData:OnUpdate(BadgeKey, function()
		Player.Data.Badge.Value = GrabbedData
	end)
end)

Is there a PlayerRemoving Event?

No, if it’s about saving then, it saves from a RemoteEvent