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

GUI that shows only when you own a Gamepass?

Asked by
130363 67
7 years ago
local id = 808263499 

game.Players.PlayerAdded:connect(function(player)
local HasPass = game:GetService("GamePassService"):PlayerHasPass(player, id)
    if HasPass then
        player:findFirstChild("SpeedUI").Frame.Visible = true
    else
        player:findFirstChild("SpeedUI"):Destroy()
    end
end)

This script is from https://scriptinghelpers.org/questions/2211/gui-that-shows-only-when-you-own-a-gamepass

But the script doesn't work now anymore in 2017. Please help me.

I don't want credit just help me please

0
make it so visible = false , i don't think :destroy() would work abnotaddable 920 — 7y

1 answer

Log in to vote
2
Answered by
FiredDusk 1466 Moderation Voter
7 years ago
Edited 7 years ago

There are 2 mistakes.

  • The 1st: Guis are stored in the Player's PlayerGui. So, after "player" on line 6 and 8, you need "PlayerGui".

  • The 2nd: findFirstChild is deprecated, I would recommend making the "f" capitalized.

If this helps, please be sure to accept my answer.

local id = 808263499 

game.Players.PlayerAdded:connect(function(player)
local HasPass = game:GetService("GamePassService"):PlayerHasPass(player, id)
    if HasPass then
        player.PlayerGui:WaitForChild("SpeedUI").Frame.Visible = true
    else
        player.PlayerGui:WaitForChild("SpeedUI"):Destroy()
    end
end)

0
Thanks Man 130363 67 — 7y
0
It says "Workspace.Script:8: attempt to index a nil value" 130363 67 — 7y
0
Instead, use WaitForChild('SpeedGui') FiredDusk 1466 — 7y
0
I edited my answer. FiredDusk 1466 — 7y
Ad

Answer this question