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

How to Make a Textbutton use a script if the user has a certain gamepass?

Asked by 1 year ago

I was wondering how to make a textbutton use a certain script but only use the script if the user has a certain gamepass.

1 answer

Log in to vote
0
Answered by 1 year ago
Edited 1 year ago

script is an example, not made to work as most of the variables arent defined.

-- detect when they use the button
textbutton.MouseButton1Click:Connect(function()
    -- checks if player owns the gamepass
    if marketplaceservice:UserOwnsGamePassAsync(userid, gamepassid) then
        --[[
        you know that they own the gamepass now
        add whatever you wanted to do here

        if you are using another script, you can use bindableevent:Fire() and bindableevent.Event:Connect()
        ]]
    end
end)

next time, you should attempt to make a script before coming here.

Ad

Answer this question