I think this code is suppose to enable a ScreenGui, but it's not working! Can someone help?
I have a piece of code, and it SHOULD enable a screengui whenever a player has a gamepass, but it's not working! Can someone please help? Code:
01 | local MarketplaceService = game:GetService( "MarketplaceService" ) |
02 | local Players = game:GetService( "Players" ) |
04 | local gamePassID = 4439769 |
06 | function onPlayerSpawned(player) |
11 | local success, message = pcall ( function () |
12 | hasPass = MarketplaceService:UserOwnsGamePassAsync(player.userId, gamePassID) |
13 | print ( "Has Game Pass" ) |
18 | warn( "Error while checking if player has pass: " .. tostring (message)) |
22 | if hasPass = = true then |
23 | game.Players.LocalPlayer.PlayerGui.Test.Enabled = true |
27 | game.Players.PlayerAdded:connect( function (player) |
28 | player.CharacterAdded:connect( function () |
29 | onPlayerSpawned(player) |
34 | Players.PlayerSpawned:Connect(onPlayerSpawned) |