So basically my script to give a badge isnt working
script:
local IDToAward = 2128438468 --Replace this with your BadgeID
local BadgeService = game:GetService("BadgeService")
local Players = game:GetService("Players")
local tool = script.Parent
function onActivation()
BadgeService:AwardBadge(Players.LocalPlayer.UserId, IDToAward)
wait (1)
Players.LocalPlayer:Kick("You got the Pink Sauce!!!")
end
tool.Activated:Connect(onActivation)
--2128438468
i dont know what i did wrong-
edit: i tested it in actual roblox, not studio.
local IDToAward = 2128438468 --Replace this with your BadgeID
local BadgeService = game:GetService("BadgeService")
game.ReplicatedStorage:WaitForChild("RemoteEvent").OnServerEvent:Connect(function(player)
BadgeService:AwardBadge(player.UserId, IDToAward)
wait(1)
player:Kick("You got the Pink Sauce!!!")
end)
local BadgeID = 2128438468
local BadgeService = game:GetService("BadgeService")
local Players = game:GetService("Players")
local tool = script.Parent
local function onActivation()
local Player = Players:FindFirstChild(tool.Parent.Name)
local success,result = pcall(function()
return BadgeService:UserHasBadgeAsync(Player.UserId,BadgeID)
end)
if success then
if not result then
BadgeService:AwardBadge(Player.UserId,BadgeID)
end
end
task.wait(1)
Player:Kick("You got the Pink Sauce!!!")
end
tool.Activated:Connect(onActivation)