I am trying to make it so when a boss is defeated, everyone in the server gets a badge. Currently I have scripted it so it fires all clients when the boss is defeated, but I cannot seem to script the badge giving bit.
Is there a way to give the player a badge when the client is fired?
Yep, all you need to do is use badge service
In the code they provide, they do
local BadgeService = game:GetService("BadgeService") local function awardBadge(player, badgeId) -- Fetch badge information local success, badgeInfo = pcall(function() return BadgeService:GetBadgeInfoAsync(badgeId) end) if success then -- Confirm that badge can be awarded if badgeInfo.IsEnabled then -- Award badge local awarded, errorMessage = pcall(function() BadgeService:AwardBadge(player.UserId, badgeId) end) if not awarded then warn("Error while awarding badge:", errorMessage) end end else warn("Error while fetching badge info!") end end
You are able to do this on the server, no need to fire the client with remote event/functions.
To ensure everyone in the server receives the badge, just use player service and use the function GetPlayers() in a loop.
This should be all you need, good luck! If you need further help, please make sure to edit your post with the code you use.
If you have any questions, let me know and I'll respond when I can. Make sure to mark this solution as correct if it works.