Idea Make the textlabel this script is within change based on if they have a specified gamepass.
Problem When I run the code, nothing happens, I own the gamepass as I created it, but it doesn't do anything at all. Any ideas?
Code
----------------- --| Variables |-- ----------------- local GamePassService = game:GetService('GamePassService') local PlayersService = game:GetService('Players') -- Stuffs local function OnPlayerAdded(player) if GamePassService:PlayerHasPass(player, 285663117) then script.Parent.Text = "Your In Gold Club" end end PlayersService.PlayerAdded:connect(OnPlayerAdded)
Thanks :D
Simple Solution
Use this code:
----------------- --| Variables |-- ----------------- local passid = 294320030 -- Gamepass ID local GamePassService = game:GetService("GamePassService") ----------------- ---| Stuffs |--- ----------------- game.Players.PlayerAdded:connect(function(player) repeat wait(0) until player.PlayerGui if GamePassService:PlayerHasPass(player, passid) then player.PlayerGui.ScreenGui.TextLabel.Text = "You're in gold club" --Put where Textlabel is. else player.PlayerGui.ScreenGui.TextLabel.Text = "Normal" --Put where Textlabel is. end end)
Next Instead of putting the Script (not a LocalScript) In the TextLabel, put it into Workspace.
You need to make a new Instance if you can't just use print.
local GamePassService = game:GetService('GamePassService') local PlayersService = game:GetService('Players') -- Stuffs game.Players.PlayerAdded:connect(function(player) if GamePassService:PlayerHasPass(player, 285663117) then script.Parent.Name= "Your In Gold Club" else script.Parent.Name= "Your Not In The Gold Club" end end)
I think this is the solution Game:GetService("GamePassService"):PlayerHasPass(player, 285663117)