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?
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