Halo For Only Who Have Badge

I want to make a halo for those with badge only -local BadgeService = game:GetService(“BadgeService”)
local Halor = game.ServerStorage.Halor:Clone()
local BadgeId = 2124676582

game.Players.PlayerAdded:Connect(function(player)
if BadgeService:UserHasBadgeAsync(player.UserId,BadgeId) then
Halor:Clone().Parent = player.Character
end - but when I try it does not work can you help me

Halor = The Halo
Badge Id = 2124676582

Can you be more specific? Does the halo not appear at all? Does it only appear for the person with the badge? Please elaborate!

1 Like

I want to make a halo for only who have badge like time trial once you get the badge that halo need it will equip on your head something like that i hope its specific for you.

Could you send us any errors that might have popped up?

You don’t have to clone a clone. The following works. In case it doesn’t on your end, the issue is probably incorrect badge ID or path.

local BadgeService = game:GetService("BadgeService")

local BADGE_ID = 2124676582

local halor = game:GetService("ServerStorage").Halor

game:GetService("Players").PlayerAdded:Connect(function(player)
	if BadgeService:UserHasBadgeAsync(player.UserId, BADGE_ID) then
		halor:Clone().Parent = player.Character
	end
end)

EDIT
Yes, I corrected the error, thank you @RigidVellerium. I am typing from my phone, but still, it was such an obvious mistake.

@DylTheDeveloperX make sure your script is located in ServerScriptService in form of a classical server script. Any attempt to clone this from local script will result in an error.

1 Like
local BadgeService = game:GetService("BadgeService")

local BADGE_ID = 2124676582

local halor = game:GetService("ServerStorage").Halor

game:GetService("Players").PlayerAdded:Connect(function(player)
	if BadgeService:UserHasBadgeAsync(player.UserId, BADGE_ID) then
		halor:Clone().Parent = player.Character
	end
end)

Re-fixed because you’d only have one Halo for the whole game if you were to use @EssenceExplorer’s. Seeing as though you still haven’t shown us your errors, I’m willing to speculate that you’re using a localscript, where you wouldn’t have access to ServerStorage/UserHasBadgeAsync (EDIT) and the player that’s testing wouldn’t exist yet.

6 Likes

Sorry late respomnse but thank you very very much!