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

GUI that shows only when you own a Gamepass?

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

1 comment

0

make it so visible = false , i don't think :destroy() would work

1 answer

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)

4 comments

0

Thanks Man

0

It says "Workspace.Script:8: attempt to index a nil value"

0

Instead, use WaitForChild('SpeedGui')

0

I edited my answer.

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