The badges in my game are broken

Hi, i got some problems with the badges. The system that award the badge don’t work in the script i made.
The badge don’t get awarded by the player when the ball and the player are inside the part.
The problem isn’t collision i already tried and it works . Its just the badge awarding system that just don’t work somehow.

local zone = script.Parent
local BadgeService = game:GetService("BadgeService")
local part = script.Parent
local ball = game.Workspace:WaitForChild("ball")
local Players = game:GetService("Players")
local BadgeId = 2153838787 -- Replace 0 with your badge ID.


part.Touched:connect(function(hit)
	print("hit")
	print(hit)
	if ball:IsA("Model") then
		if hit.Parent:FindFirstChild("Humanoid") then
			local Player = Players:GetPlayerFromCharacter(hit.Parent)

			if BadgeService:UserHasBadgeAsync(Player.UserId, BadgeId) == false then
				BadgeService:AwardBadge(Player.UserId, BadgeId)
			end
		end
	end
end)

4 Likes

Is this a local script? or a server script? You cannot reward badges on a local script.

local zone = script.Parent
local BadgeService = game:GetService("BadgeService")
local part = script.Parent
local ball = game.Workspace:WaitForChild("ball")
local Players = game:GetService("Players")
local BadgeId = 2153838787

part.Touched:Connect(function(hit)
	print("hit")
	print(hit)
	if ball:IsA("Model") then
		if hit.Parent:FindFirstChild("Humanoid") then
			local Player = Players:GetPlayerFromCharacter(hit.Parent)

			if BadgeService:UserHasBadgeAsync(Player.UserId, BadgeId) == false then
				BadgeService:AwardBadge(Player.UserId, BadgeId)
			end
		end
	end
end)

Make sure the part zone that triggers the badge award is set up correctly and its name matches the one in your script.

No i used a server script so i don’t know why this isn’t working thats really weird any idea why?

  1. thank u very much you helped me fixed it i loveu
1 Like

I’m happy it works! I wish you luck in what you are doing!

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.