What do you want to achieve? I want to award the player a badge by a remote event
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
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.
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.
Woah u actually gave me a hint more to discovered the issue
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
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