Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Having issues with giving a screen gui when player buys a gamepass?

Asked by 7 years ago

Here is the script:

local id = 749645444
game.Players.PlayerAdded:connect(function(player)
    if local HasPass = Game:GetService("GamePassService"):PlayerHasPass(player, id) then
player:findFirstChild("PlayerGui").Teleport.Visible = true else player:findFirstChild("PlayerGui").Teleport.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)

How do I make this script indicate that a GUI will be given to the players if they bought a gamepass?

0
There's multiple problems, but I'll only point out where they're: Lines 3, 4, 6, 8. TheeDeathCaster 2368 — 7y
0
u disliked I know u did @TheeDeathCaster ArcticBandit 5 — 7y

1 answer

Log in to vote
0
Answered by
FiredDusk 1466 Moderation Voter
7 years ago

I have left some comments below.

local GamePassService = game:GetService("GamePassService")
local id = 749645444

game.Players.PlayerAdded:Connect(function(Player)
    if GamePassService:PlayerHasPass(Player, id) then
        Player:FindFirstChild("PlayerGui").Teleport.Visible = true -- "findFirstChild" should be with a capital "F"
    else 
        Player:FindFirstChild("PlayerGui").Teleport.Visible = false
        local x = Instance.new("Message",workspace)
        x.Text = Player.Name.. " does not have the game pass!" -- we don't need the "or" and "and" because, of course the player won't have it since it is in this else.
        wait(2)
        x:Destroy() --Destroying is better than removing
    end
end)

If this helped, please be sure to accept my answer if this helped :)

Ad

Answer this question