Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Nil value when trying to sell clothes?

I found a script and model that sells clothes, and i tried changing it to how i need it to work and something is wrong. Basically i'm trying to get it to buy the clothes once you press a gui button.

local Buy = script.Parent
local ITEM_ID = 887227764  -- Here put the ID of the clothes you want to sell

Buy.MouseButton1Click:Connect(Clicked)
game:GetService("MarketplaceService"):PromptPurchase(p,ITEM_ID)

1 answer

✓ Accepted answer

You don't have the event set up correctly

local Buy = script.Parent
local ITEM_ID = 887227764  -- Here put the ID of the clothes you want to sell

Buy.MouseButton1Click:Connect(function()
	game:GetService("MarketplaceService"):PromptPurchase(p,ITEM_ID)
end)

Im guessing p is the player and Buy is the button

3 comments

0

"MarketplaceService:PromptPurchase() player should be of type Player, but is of type nil" do you know how to fix this?

0

@Sniper2458 did you set p as the player? if not, local p = game.Players.LocalPlayer , if this is a localscript

0

This worked, thank you very much!

This discussion is preserved as it was. New answers, comments, and votes are closed.