01 | local id = 6741728 |
02 | game.Players.PlayerAdded:connect( function (player) |
03 | if local HasPass = Game:GetService( "GamePassService" ):PlayerHasPass(player, id) then |
04 | player:findFirstChild( "PlayerGui" ).VIPgui.Visible = true else player:findFirstChild( "PlayerGui" ).VIPgui.Visible = false |
05 | local x = Instance.new( "Message" ,Workspace) |
06 | x.Text = player.Name .. (HasPass and " has" or " doesn't have" ).. " the game pass!" |
07 | wait( 2 ) |
08 | x:Remove() |
09 | end |
10 | 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:
1 | local bruh = game.ServerStorage:WaitForChild( "YourGuiNameAhhh" ) --Your Gui |
2 | local ok = game:GetService( "MarketplaceService" ) |
3 |
4 | game.Players.PlayerAdded:Connect( function (Player) |
5 | if ok:UserOwnsGamePassAsync(Player.UserId, YourIdHereXdOof) then |
6 | local meh = bruh:Clone() |
7 | meh.Parent = Player.PlayerGui |
8 | end |
9 | 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.
01 | -- Server Script |
02 | local remote = Instance.new( "RemoteEvent" , game.ReplicatedStorage) |
03 |
04 | local id = 6741728 |
05 | game.Players.PlayerAdded:connect( function (player) |
06 | if Game:GetService( "GamePassService" ):PlayerHasPass(player, id) then |
07 |
08 | local HasPass = Game:GetService( "GamePassService" ):PlayerHasPass(player, id) |
09 |
10 | player:findFirstChild( "PlayerGui" ).VIPgui.Visible = true |
11 |
12 | else |
13 |
14 | player:findFirstChild( "PlayerGui" ).VIPgui.Visible = false |
15 |