Hello! I am a new scripter on Roblox. Like very new, but anyway I wanted to make a script that allows players to earn a badge when they touch certain parts. This is for my Obby that I have been working on. I tried to scripting a part to do so and I have no luck I have watched multiple YouTube videos and looked on google to try to find a working script, but I can’t find one. When I run the script it has no errors. Here is my script that I am using
local BadgeService = game:GetService("BadgeService")
local id = 2124656502
local badgegive = script.Parent
badgegive.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
if not BadgeService:UserHasBadgeAsync(plr.UserId, id) then
BadgeService:AwardBadge(plr.UserId, id)
end
end
end)
If anybody could please help it would be greatly appreciated!
Thank You!