Award badge when you clicked on a brick doesn't work I tryed to make one but i won't work
help me Thanks :P
wait (2) print("Badge Awarder Loaded. BadgeID: " .. script.Parent.BadgeID.Value) Part789 = script.Part789 p = script.Parent.Players function onClicked() if (script.Part789:FindFirstChild("Humanoid") ~= nil) then if (p ~= nil) then local BadgeID = 210342277 -- Badge id 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 end script.Parent.ClickDetector.MouseClick:connect(onClicked)
The way you defined 'p' was incorrect. Pardon if I re-write your code a bit, but it's just how I'm used to it.
wait (2) print("Badge Awarder Loaded. BadgeID: " .. script.Parent.BadgeID.Value) Part789 = script.Part789 script.Parent.ClickDetector.MouseClick:connect(function(p) if (script.Part789:FindFirstChild("Humanoid") ~= nil) then -- I hope this isn't checking for an actual Player's humanoid if (p ~= nil) then -- This line isn't really necessary since nothing else can click local BadgeID = 210342277 -- Badge id 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 end)