Badge service not awarding badge from remote event

  1. What do you want to achieve? I want to award the player a badge by a remote event

  2. What is the issue? When the event script executes it does execute the rest of the script with no problem but it doesnt award any badge

  3. What solutions have you tried so far? I tried using bindable events or using local scripts to trigger remote event, im using server sided script right now. i tried searching for other people with the same issue but theyr solution was just using server sided script.

This is the script that triggers the remote event, Server sided script :

local part = script.Parent
local model = script.Parent.Parent
local rs = game:GetService("ReplicatedStorage")
local presentfolder = rs:WaitForChild("Presents")
local presentevent = presentfolder:WaitForChild("ExamplePresent")
local db = false
local plrs = game:GetService("Players")
local sound = script.Sound


part.Touched:Connect(function(hit)
	local plr = plrs:GetPlayerFromCharacter(hit.Parent)
	if plr then
		if not db then
			db = true
			model:Destroy()
			presentevent:FireClient(plr,sound)
			wait(1)
			db = false
		end
	end
end)

and this is the remote event script, Server Sided :

local rs = game:GetService("ReplicatedStorage")
local folder = rs:FindFirstChild("Presents")
local event1 = folder:WaitForChild("ExamplePresent")
local bs = game:GetService("BadgeService")
local presentgiveid = 1093735922911168
local plrs = game:GetService("Players")

event1.OnServerEvent:Connect(function(plr,sound)
	bs:AwardBadge(plr.UserId,presentgiveid)
	sound:Play()
end)

ive had this same issue in the past and i dont know how to fix it.

1 Like

You typed OnServerEventEvent instead of OnServerEvent

Thanks i did’nt notice that i fixed it now, still thought this didnt fix the issue it still happens

You should definitely try debugging stuff like this yourself before asking here
I’m not trying to be mean but it will cost you less time
Like in this case you could’ve just looked at the script errors and noticed it saying that OnServerEventEvent is not a valid member

Oh yeah a big piece of information sorry first time posting i already tried debugging AND i dont get any error on output or warning if that would be the case i wouldnt be posting here.

1 Like

If this has been fixed, please declare @NyrionDev response as a Solution.

i mean fixed the error but it didnt fix the entire issue im having with awarding badge, it just fixed a miss spell word not the entire issue.

You’re still not getting the badge awarded?

Indeed, it just fixed a miss spell not the entire issue

Possible fixes:

  • Check if the badge is under your game and it’s published
  • Ensure you don’t own the badge already
  • The first script you send should be a Server Script
  • The second script should be a Local Script

If it’s none of the things i listed. Try adding prints to find the problem.

Woah u actually gave me a hint more to discovered the issue
image
And hear me out cause i dont want anybody to ask me after “Did u try it on your roblox client?” i tried it on my roblox client and it didnt award me the badge BUT i get this warning i think its a step closer to fix the issue.

By the way i tried the last solution i did try this before but it didnt give any warning or error before and didnt award badge

You are trying to reward the badge from a LocalScript, it needs to be a normal server Script.

Yeah. Make sure that you only play the sound for the player on the client. But the whole badge award code in the touched function. For potential errors, check if they dont have the badge yet.

if not BadgeService:UserHasBadgeAsync(plr, yourId) then
-- do something
end

Update Fixed it thanks everyone

1 Like