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;
local clone = game.StarterGui.VIPBlockGUI:Clone() local id = 924277735 game.Players.PlayerAdded:connect(function(player) if game:GetService("GamePassService"):PlayerHasPass(player, id) then print("player has the gamepass :O") else print("player doesn't have the gamepass :(") clone.Parent = player.PlayerGui end end)
If you're wondering, this is the script for the Prompt, this is in LocalScript format.
local gamepass = 924277735 local player = game.Players.LocalPlayer script.Parent.MouseButton1Click:connect(function() game:GetService("MarketplaceService"):PromptPurchase(player, gamepass) end)
This is how it looks in studio; http://prntscr.com/fxrzfi. Please get back to me as soon as you can find a solution!
1st. FilteringEnabled should be on to hide it 2nd. Just make the SurfaceGui a child of the part in the server and not in StarterGui, because the only reason it's showing the GUI is because the Adornee is set 3rd. Try these scripts
ServerScript
local showGui = Instance.new("RemoteEvent", game.ReplicatedStorage) showGui.Name = "ShowVIPGui" local clone = game.StarterGui.VIPBlockGUI:Clone() local id = 924277735 game.Players.PlayerAdded:connect(function(player) if game:GetService("GamePassService"):PlayerHasPass(player, id) then showGui:FireClient(player, true) else showGui:FireClient(player, false) end end)
LocalScript - Child of Workspace > Part > VIPBlockGUI
local gamepass = 924277735 local player = game.Players.LocalPlayer local showGui = game.ReplicatedStorage:WaitForChild("ShowVIPGui") showGui.OnClientEvent:connect(function(bool) if bool then script.Parent:Destroy() else script.Parent.MouseButton1Click:connect(function() game:GetService("MarketplaceService"):PromptPurchase(player, gamepass) end) end end)