Equip system for only who have badge

Hi developers! i make script about halo gui. what im trying to do is the only people who have badge can equip it and unequip can somebody help me to figure out whats wrong with my script.

local player = game.Players.LocalPlayer

local BadgeService = game:GetService(“BadgeService”)

local BADGE_ID = 2124676582

local OwnBadge = BadgeService:UserHasBadgeAsync(player.UserId, BADGE_ID)

local haloGui = game.StarterGui.Halo

local haloFrame = haloGui.MainFrame:WaitForChild(“Purple Frame”)

local equip = haloFrame:WaitForChild(“Equip”)

local locked = haloFrame:WaitForChild(“Locked”)

local unequip = haloFrame:WaitForChild(“Unequip”)

local equipped = haloFrame:WaitForChild(“Equipped”)

local unequipped = haloFrame:WaitForChild(“Unequipped”)

haloFrame.Visible = false

if OwnBadge then

haloFrame.Visible = true

equip.Visible = true

unequip.Visible = true

end

if not OwnBadge then

haloFrame.Visible = true

equip.Visible = false

unequip.Visible = false

locked.Visible = true

equipped.Visible = false

unequipped.Visible = false

end

Thats the script thanks guys!

Try doing

if OwnBadge then
    haloFrame.Visible = true
    equip.Visible = true
    unequip.Visible = true
else
    haloFrame.Visible = true
    equip.Visible = false
    unequip.Visible = false
    locked.Visible = true
    equipped.Visible = false
    unequipped.Visible = false
end

Also, could you show us your explorer, specifically the GUI and its children?

LocalScript:

local player = game.Players.LocalPlayer

local BadgeService = game:GetService("BadgeService")

local BADGE_ID = 2124676582

local OwnBadge = BadgeService:UserHasBadgeAsync(player.UserId, BADGE_ID)

local haloGui = player:WaitForChild("PlayerGui").Halo

local haloFrame = haloGui.MainFrame:WaitForChild("Purple Frame")

local equip = haloFrame:WaitForChild("Equip")

local locked = haloFrame:WaitForChild("Locked")

local unequip = haloFrame:WaitForChild("Unequip")

local equipped = haloFrame:WaitForChild("Equipped")

local unequipped = haloFrame:WaitForChild("Unequipped")

haloFrame.Visible = false

local function CheckForBadge()
if OwnBadge == true then
	haloFrame.Visible = true
	equip.Visible = true
	unequip.Visible = true
end
if OwnBadge == false then
	haloFrame.Visible = true
	equip.Visible = false
	unequip.Visible = false
	locked.Visible = true
	equipped.Visible = false
	unequipped.Visible = false
   end
end

CheckForBadge()