If a player has a Ticket in his inventory the button is disabled

Hello,

I currently have a button, if you click a ClickDetector, you get a Ticket.
What i need is the following:
If you click the ClickDetector you get a ticket (I already have) But if you got the Ticket, and try to get another one, you cannot cause you already have it in your inventory.

Maybe through the server create a boolValue inside the player which says whether the player has a ticket or not, and then on the clickDetector make sure the boolValue’s value is false, I haven’t tried it but it should work.

you can use

if Player.Something:FindFirstChild("Ticket") then return end

When using the Click Detector for the button, you first check if the player already has a ticket, I dont know how your inventory system works but if it were a folder you could do something like this for example:

local ClickDetector = script.Parent

ClickDetector.MouseClick:Connect(function(PlayerWhoClicked)
    local Inventory = --Variable to the players inventory
    if not Inventory:FindFirstChild(Ticket) then
        --function that gives the player their ticket
    end
end)

I have not tested this but if there are any problems tell me

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.