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

I added this script to my TextButton... should it work?

Asked by 10 years ago

Should this work. If you have the game pass then this should work. THis script is inserted in a TextButton.

local passId = 182358984

function isAuthenticated(player)
    return game:GetService("GamePassService"):PlayerHasPass(player, passId)
end

game.Players.PlayerAdded:connect(function(plr)
    if isAuthenticated(plr) then
        print("Loaded gamePass for a Player")
     script.Parent.MouseButton1Click:connect(function()
        number = 0
        number = number + 3
        script.Parent.Parent.TextBox.Text = number
    else
        number = 0
        number = number + 1     
        script.Parent.Parent.TextBox.Text = number
        end)
    end
end)
0
I got most of this from the ROBLOX wiki. raystriker6707 30 — 10y
0
Um... in Studio there is an error on line #14. raystriker6707 30 — 10y
0
I think that since "else" is in a function it does not work but I don't know any onther way to do this... raystriker6707 30 — 10y

1 answer

Log in to vote
0
Answered by
Tkdriverx 514 Moderation Voter
10 years ago
local passId = 182358984

function isAuthenticated(player)
    return game:GetService("GamePassService"):PlayerHasPass(player, passId)
end

game.Players.PlayerAdded:connect(function(plr)
    local number = 0
    if isAuthenticated(plr) then
        print("Loaded gamePass for a Player")
        script.Parent.MouseButton1Click:connect(function()
            number = number + 3
            script.Parent.Parent.TextBox.Text = number
        end) -- Moved the end here
    else
        number = number + 1     
        script.Parent.Parent.TextBox.Text = number
    end
end)
Ad

Answer this question