Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Help with Gamepass/Badge scripts to make their parent's visible not working?

I need some help on making these scripts make their Parents visible (I have FilteringEnabled On) This,

--LocalScript, Badge script (Supposed to make it's parent visible if player has the badge)
local BadgeService = game:GetService("BadgeService")
local BadgeId = 753788867
 
game:GetService("Players").PlayerAdded:connect(function(player)
    if BadgeService:UserHasBadge(player.UserId, BadgeId) then
        game.Players.LocalPlayer.PlayerGui.PCgui.Inventory.Achieve.Show.Welcome.Visible = true
    else
        print("The user does not have this badge")
    end
end)

And this

--LocalScript, Gamepass script (Supposed to make it's parent visible if player has the pass)
local id = 828677881
 
game.Players.PlayerAdded:connect(function(player)
    if Game:GetService("GamePassService"):PlayerHasPass(player, id) then 
        game.Players.LocalPlayer.PlayerGui.PCgui.Inventory.Inventory.Show.Pass.Bike.Visible = true
    else
        print(player.Name .. " doesn't have the game pass...")
    end
end)

1 answer

Im assuming you have these in workspace or someplace other than in the GUI, unfortunately in FE there is no access to the PlayerGui, therefore put the scripts inside the GUI and change them to this:

Badge:

--Put this inside the object called Welcome
local BadgeService = game:GetService("BadgeService")
local BadgeId = 753788867

game:GetService("Players").PlayerAdded:connect(function(player)
    if BadgeService:UserHasBadge(player.UserId, BadgeId) then
        script.Parent.Visible = true
    else
        print("The user does not have this badge")
    end
end)

and for the Gamepass:

--put this inside the object called Bike
local id = 828677881

game.Players.PlayerAdded:connect(function(player)
    if Game:GetService("GamePassService"):PlayerHasPass(player, id) then 
        script.Parent.Visible = true
    else
        print(player.Name .. " doesn't have the game pass...")
    end
end)

Hope this helps!

1 comment

0

Also ensure that these are localscripts as GUIs are on the client side of fe so therefore they need to be localscripts to work

This discussion is preserved as it was. New answers, comments, and votes are closed.