#Badge When you touch a Part
1 messages · Page 1 of 1 (latest)
Have you looked at any tutorials?
Or the roblox docs?
Help yourself man. 🙏
Oh, I had forgotten about this, okay, thank you
The Badge Script is not working, here it is:
local BadgeService = game:GetService("BadgeService")
local BadgeId = 472392118680042
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") and game.Players:FindFirstChild(hit.Parent.Name) then
local Player = game.Players[hit.Parent.Name]
BadgeService:AwardBadge(Player.UserId, BadgeId)
end
end)
It the AwardBadge (line 7) i think because Rbx Studio Report a Error
?
@autumn timber
Wsup?
Here is the example from the page: local BadgeService = game:GetService("BadgeService")
local Players = game:GetService("Players")
local BADGE_ID = 0
local function awardBadge(player, badgeId)
-- Fetch badge information
local success, badgeInfo = pcall(function()
return BadgeService:GetBadgeInfoAsync(badgeId)
end)
if success then
-- Confirm that badge can be awarded
if badgeInfo.IsEnabled then
-- Award badge
local awardSuccess, result = pcall(function()
return BadgeService:AwardBadge(player.UserId, badgeId)
end)
if not awardSuccess then
-- the AwardBadge function threw an error
warn("Error while awarding badge:", result)
elseif not result then
-- the AwardBadge function did not award a badge
warn("Failed to award badge.")
end
end
else
warn("Error while fetching badge info: " .. badgeInfo)
end
end
local function onPlayerAdded(player)
awardBadge(player, BADGE_ID)
end
Players.PlayerAdded:Connect(onPlayerAdded)
I can check ur code tomorrow on my pc
** You are now Level 6! **