I’m trying to make VIP exclusive foods for my game, so I made this script:
commands.giveto = function(sender,arguments)
if sender:GetRankInGroup(11635716) >= 3 then
local character = sender.Character or sender.CharacterAdded:Wait()
local item
for i, tool in pairs(character:GetChildren()) do
if tool.ClassName == "Tool" and tool.Name ~= "Mop" and tool.Name ~= "Notepad" then
item = tool
print(item.Name) break
end
end
if not item then return end
for i, playerName in pairs(arguments) do
print(playerName)
end
local customerName = arguments[1]
if customerName then
local customer = findPlayer(customerName)
if customer then
print(item.Name)
if item.Name == ("Atole" or "CoffeeMilk" or "Hwachae" or "Licuado" or "Sujeonggwa" or "YujaCha" or "Consomme" or "Crostini" or "Sushi" or "DimSum" or "Dondurma" or "Pavlova")then
local hasPass = false
local success, message = pcall(function()
hasPass = MarketplaceService:UserOwnsGamePassAsync(customer.UserId, 95142223)
end)
if not success then
print("Error checking VIP pass:"..tostring(message))
end
print(hasPass)
if hasPass then
item.Parent = customer:WaitForChild("Backpack")
addPoints.addPoints(sender, 1)
else
MarketplaceService:PromptGamePassPurchase(customer, 95142223)
end
else
item.Parent = customer:WaitForChild("Backpack")
addPoints.addPoints(sender, 1)
end
end
end
end
end
What it does, is it checks if when you are trying to hand a food to someone, if that food is VIP exclusive. Then it checks if the customer is VIP. If they aren’t, it prompts them to buy the pass. If they are, it gives them the food. I tested this though, and it won’t work if the customer isn’t VIP. Why is this happening?