Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
Admin8483 -21
6 years ago

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

Log in to vote
0
Answered by 6 years ago

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!

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 Potatofoox 129 — 6y
Ad

Answer this question