I'm making a little GUI that prompts you to purchase an asset if the player does not own it, and simply changes the GUI to the booked screen if the player owns that asset, though I've used a few prints, I still can't find the error. Any help would be appreciated!
local btn = script.Parent
local class = script.Parent.Parent:WaitForChild("CLASS")
local ec = script.Parent.Parent:WaitForChild("EC")
local fc = script.Parent.Parent:WaitForChild("FC")
local slc = script.Parent.Parent:WaitForChild("SLC")
local title = script.Parent.Parent:WaitForChild("TITLE")
local MPC = game:GetService("MarketplaceService")
function CheckBCAndGive(plr)
if MPC:PlayerOwnsAsset(plr,1253356769) then
print 'Player owns asset'
btn.Visible = false
ec.Visible = false
fc.Visible = false
title.Text = "Thank you for flying with us!"
slc.Text = "Class booked:"
class.Text = "Business"
else
print 'Player does not own asset; prompting purchase'
MPC:PromptPurchase(plr,1253356769)
end
end
btn.MouseButton1Click:Connect(CheckBCAndGive)
The assets are T-shirts.
