Disclaimer: I am not an expert at all.
I made a script to prompt a purchase of an item based on touch.
The item is uploaded by my group, the game is uploaded directly under my main account. the item is new and for sale.
The script works for my main (i get a prompt that I already own the item)
But nothing is triggered when I don’t play with my main, so no one can buy it in-game.
Does anyone know what might be the cause of this?
This is my code
-- Get the ID of the item you want to prompt the player to purchase
local itemId = 123456789 -- Replace with the actual ID of the item
-- Function to handle when a player touches the part
local function onTouch(other)
-- Check if the object touching the part is a player
local character = other.Parent
local player = game.Players:GetPlayerFromCharacter(character)
if player then
-- Prompt the player to purchase the item
game:GetService("MarketplaceService"):PromptPurchase(player, itemId)
end
end
-- Connect the function to the part's Touch event
script.Parent.Touched:Connect(onTouch)