#rebirth badge

1 messages · Page 1 of 1 (latest)

ancient island
#

I'm trying to create a badge for whenever a player rebirths ..could someone look over my script for me please, and does it have to be a local script to work?

#
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local playerGui = player.PlayerGui
local rebirthButton = playerGui.MainGui.RebirthFrame.RebirthButton
rebirthButton.MouseButton1Click:Connect(function(hit)
    if hit.Parent:FindFirstChild("Humanoid") then
        local player = game.Players:GetPlayerFromCharacter(hit.Parent)

        local success, HasBadge = pcall(BadgeService.UserHasBadgeAsync, BadgeService, player.UserId, 1158970328657874)
        if not success then
            print("Failed to check if user has badge")
        end
        if not HasBadge then
            local success, errorMessage = pcall(BadgeService.AwardBadgeAsync, BadgeService, player.UserId, 1158970328657874)
            if not success then
                print(errorMessage)
            end
        end
    end
end)```
burnt bluff
#

Trying to use local player and detect mouse click

#

My discord sent twice

ancient island
#

but idk why badgeservice is underlined now

#

oh.. BadgeService can't be used on local scripts

#

then what do i do

upbeat wadi
#

fix your indentation

ancient island
#

oops

upbeat wadi
# ancient island

you probably forgot to define badgeservice. i doubt you can award from client but you can probably check localplayer only

burnt bluff
#

I was gonna write that