Hey there! I’m making a hat system where you need a badge to equip it. You go up to the hat and activate a proximity prompt to equip. Problem is, the prompt activates no matter what badge you have, weather you own it or not.
Current Script: (LOCAL)
local player = game.Players.LocalPlayer
local badgeid = 2133603122
local PlayerOwnBadge = game:GetService("BadgeService"):UserHasBadgeAsync(player.UserId, badgeid)
if PlayerOwnBadge then
workspace.Pan.ProximityPrompt.Enabled = true
else
workspace.Pan.ProximityPrompt.Enabled = false
end
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.
local Players = game:GetService("Players")
local BadgeService = game:GetService("BadgeService")
local player = Players.LocalPlayer
local badgeId = 2133603122
local function checkBadge()
local success, hasBadge = pcall(function()
return BadgeService:UserHasBadgeAsync(player.UserId, badgeId)
end)
if success and hasBadge then
workspace.Pan.ProximityPrompt.Enabled = true
else
workspace.Pan.ProximityPrompt.Enabled = false
end
end
-- Call the function to check the badge
checkBadge()
I got it to work, the problem was on the other hats it made the pan enable as well because I had their badges. I’ll still give you the solution though!