local id = 6741728 game.Players.PlayerAdded:connect(function(player) if local HasPass = Game:GetService("GamePassService"):PlayerHasPass(player, id) then player:findFirstChild("PlayerGui").VIPgui.Visible = true else player:findFirstChild("PlayerGui").VIPgui.Visible = false local x = Instance.new("Message",Workspace) x.Text = player.Name .. (HasPass and " has" or " doesn't have").. " the game pass!" wait(2) x:Remove() end end)
It won't work! any ideas ? :/
You make the gui in the server storage so exploiters can't get the gui. Maybe this thing will work:
local bruh = game.ServerStorage:WaitForChild("YourGuiNameAhhh") --Your Gui local ok = game:GetService("MarketplaceService") game.Players.PlayerAdded:Connect(function(Player) if ok:UserOwnsGamePassAsync(Player.UserId, YourIdHereXdOof) then local meh = bruh:Clone() meh.Parent = Player.PlayerGui end end
If that's full code, then the issue is, that you don't have HasPass Defined anywhere, so there is no way for conditional to be true I think.
-- Server Script local remote = Instance.new("RemoteEvent", game.ReplicatedStorage) local id = 6741728 game.Players.PlayerAdded:connect(function(player) if Game:GetService("GamePassService"):PlayerHasPass(player, id) then local HasPass = Game:GetService("GamePassService"):PlayerHasPass(player, id) player:findFirstChild("PlayerGui").VIPgui.Visible = true else player:findFirstChild("PlayerGui").VIPgui.Visible = false local x = Instance.new("Message",Workspace) x.Text = player.Name .. (HasPass and " has" or " doesn't have").. " the game pass!" wait(2) x:Remove() end end)