I need help with making this script being OnClicked script, I have tried switching some stuff in the script and it didnt work.
print("Badge Awarder Loaded. BadgeID: " .. script.Parent.BadgeID.Value)
function OnTouch(part)
if (part.Parent:FindFirstChild("Humanoid") ~= nil) then
local p = game.Players:GetPlayerFromCharacter(part.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
end
script.Parent.Touched:connect(OnTouch)
I have tried switching some stuff in the script and it didnt work.

2 comments
The only difference is that the MouseClick event passes a 'player' parameter instead of the 'part' parameter, so instead of using GetPlayerFromCharacter you can completely skip that step.
So, I can remove it?