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

This script for an AssetOwned ticket giver is not working. I am not sure what to do, suggestions?

Asked by 4 years ago

I'm trying to make a button where if a player owns a certain shirt then they can receive a certain ticket.

I'm trying to check if the player owns a certain asset. I have a global variable that has the shirt ID but it doesn't seem to be working. I've modified the variable to work in a local script, too. any help?

local p = game.Players.LocalPlayer
local Player = game:GetService("Players").LocalPlayer
local MarketPlace = game:GetService("MarketplaceService")
local FCS = _G.FCS

script.Parent.MouseButton1Click:Connect(function()
    if MarketPlace:PlayerOwnsAsset(FCS)then
    local tool = script.Parent.FirstClassTicket:Clone()
    tool.Parent = p.Backpack
    wait(1)
    Player.PlayerGui.SCIGui.BackgroundBlack.Visible = false
    Player.PlayerGui.SCIGui.BackgroundBlack.Active = false
    else
        Player.PlayerGui.SCIGui.BackgroundBlack.text3.Visible = true
        wait(2)
        Player.PlayerGui.SCIGui.BackgroundBlack.text3.Visible = false
    end
end)

Answer this question