Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to award a badge to the player through an item?

So I have a script that is placed inside an item in the replicatedstorage.

if (script.Parent.Parent.Parent:FindFirstChild("Humanoid") ~= nil) then
    print "lol"
p = script.Parent.Parent.Parent
    if (p ~= nil) then
        print("Awarding BadgeID: " ..script.Parent.BadgeID.Value .. " to UserID: " .. p.userId)
        local b = game:GetService("BadgeService")
        b:AwardBadge(p.userId, script.Parent.BadgeID.Value)
    end
end

When the player has it in their inventory, they should receive a badge, however, it isn't working. Any help?

1 answer

Just award the badge when they gain the item?!?!?!

and btw you don't need ~= nil when evaluating an expression as such in an if statement.

if script.Parent.Parent.Parent:FindFirstChild("Humanoid") then
	--do stuff
end

this isn't javascript

2 comments

1

Exactly. Why wait until they get the tool, when you can just award them once they got the tool?

0

really makes you think.

This discussion is preserved as it was. New answers, comments, and votes are closed.