****Hello! First of all, im still learning so don't judge me ;-;. Secondly, I already have made a badge, and im wondering how to give it when it's touched. The reason im doing this is because the answers to these questions were 5 years ago. Im sure this is the beginnings I could use maybe(optional)
if game.workspace.Part.Touched then
or
function onTouch()
Please help!
P.s please tell me if i use local script or just script
For awarding the badges, look at this post on the Roblox Developer Hub
As for the in-game side of things, use this:
local Part = game.Workspace.Part Part.Touched:Connect(function() AwardBadge() -- This would be where your badge awarding function is called end)
Don't forget to check if the player already has the badge (which is covered in the post that I have linked), and add a Debounce if you find that you need it.
Hello, here's the script you wanted:
THIS IS A SCRIPT!
local Part = game.Workspace.Part local BadgeService = game:GetService("BadgeService") function awardBadge(player, badgeId) if BadgeService:IsLegal(badgeId) and not BadgeService:IsDisabled(badgeId) then BadgeService:AwardBadge(player.UserId, badgeId) end end Part.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then awardBadge(game.Players[hit.Parent.Name].UserId,000000) -- insted of the zero's put ur badge id in end end)
use it if you want to