When it time to reward the player with the badge the console says this…
or it just doesn’t give the playe the badge
This is the script that goes with it
Local script
local badgeData = game.ReplicatedStorage.Components.Objects.ChristmasEvent:FindFirstChild("BadgeData")
badgeData:FireServer(player.UserId)
Script in serverscriptstorage
local BadgeService = game:GetService("BadgeService")
local badgeId = 456989618962327
local function awardBadge(player, badgeId)
local success, badgeInfo = pcall(BadgeService.GetBadgeInfoAsync, BadgeService, badgeId)
if success then
if badgeInfo.IsEnabled then
local awarded, errorMessage = pcall(BadgeService.AwardBadge, BadgeService, player.UserId, badgeId)
if not awarded then
warn("Error while awarding badge:", errorMessage)
end
end
else
warn("Error while fetching badge info!")
end
end
Do anyone know how I would fix this + why its showing that error
local BadgeService = game:GetService("BadgeService")
local Players = game:GetService("Players")
local RS = game:GetService("ReplicatedStorage")
local remote = RS:WaitForChild("RemoteEvent")
local badgeId = 1606426293935544
remote.OnServerEvent:Connect(function(player)
if not BadgeService:UserHasBadgeAsync(player.UserId, badgeId) then
BadgeService:AwardBadge(player.UserId, badgeId)
end
end)
Local code:
local RS = game:GetService("ReplicatedStorage")
local remote = RS:WaitForChild("RemoteEvent")
local player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:Connect(function()
remote:FireServer(player)
end)
So i would do something like this just change the event etc. and it should work.