New: Nitro Boost our Discord server and receive full donation perks here on the website! Join the Scripting Helpers Discord Server to learn more! You can also Support on Patreon as always.
Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

Weapon GUI help?

Asked by 4 years ago

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)
0
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. bobder2 135 — 4y
0
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. HurricaneOtto 0 — 4y

Answer this question