VIP SurfaceGUI wont dissappear to gamepass holders?
I have a SurfaceGUI that blocks a staircase, when a player without a pass walks through it, it respawns them, when they do have the pass it leaves them alone. Although I'm confused, I have a script that in my eyes should be vanishing the SurfaceGUI once the player has the pass for them. This is what the surfaceGUI looks like; http://prntscr.com/fxrx3e. The "Buy Now" script works, that's fine but the disappearing script won't. Please note that the surfaceGUI is Adorned to the block from StarterGUI.
This is the code that is supposed to take the GUI away once the player has a pass, it is in Normal Script format;
01 | local clone = game.StarterGui.VIPBlockGUI:Clone() |
04 | game.Players.PlayerAdded:connect( function (player) |
05 | if game:GetService( "GamePassService" ):PlayerHasPass(player, id) then |
06 | print ( "player has the gamepass :O" ) |
08 | print ( "player doesn't have the gamepass :(" ) |
09 | clone.Parent = player.PlayerGui |
If you're wondering, this is the script for the Prompt, this is in LocalScript format.
1 | local gamepass = 924277735 |
2 | local player = game.Players.LocalPlayer |
4 | script.Parent.MouseButton 1 Click:connect( function () |
5 | game:GetService( "MarketplaceService" ):PromptPurchase(player, gamepass) |
This is how it looks in studio; http://prntscr.com/fxrzfi. Please get back to me as soon as you can find a solution!