I've been trying and asking all I know but it just seems to be impossible to make. I'm trying to make a Weapon GUI. As simple as that sounds, it doesn't appear to be. Within the game, there are badges that can be collected. Once a certain badge is collected, the weapon should be equipable by a button in the GUI. However, there doesn't appear to be a script that exists or is even possible to allow this. I'm assuming it would follow along the lines of a gamepassservice, but how would that work? The closest I've come to making this is the following, but it doesn't even work. Any options? My attempt ~
local ID = 158694379
local badge = game:GetService("BadgeService")
local player = game.Players.LocalPlayer
function find(userid, badgeid)
if badge :UserHasBadge(userid, badgeid) then
local clone = game.ReplicatedStorage.GravityCoil:clone()
local clone2 = game.ReplicatedStorage.GravityCoil:clone()
clone.Parent = player.Backpack
clone2.Parent = player.StarterGear
else
script.Parent.MouseButton1Click:Destroy()
--script.Parent.BackgroundColor3 = Color3.New(.5, .5, .5)
end
end
script.Parent.MouseButton1Click:connect(function() find(player.userId, ID) end)

2 comments
I'm not sure why it's not working for you. Are you sure the player you're using to test has the badge? I don't think test server players can get badges, so you'll have to test it on a published game. If that's not the issue try putting some print()'s in the script to see where the script goes to in your if statements.
I've unfortunately tried that. Can a badge not affiliated with the game not work in this case maybe? I'm using badges from 3 of my games which are linked together.