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

How i make a developer product script?

I don't see any errors it but doesn't work. There is the script:

function Click()
local players = game.Players.LocalPlayer

local id = 327347843
			
local p = game:GetService("MarketplaceService"):PromptProductPurchase(players, id)

if money == players:FindFirstChild("leaderstats"):WaitForChild("Money") then
	if money == p then
		money.Value = money.Value + 2
	end
end

script.Parent.MouseButton1Click:Connect(Click)

3 comments

0

i belive it cant be in a local script

0

it is a localscript

0

Can you describe what actually doesn't work in your code so we can help? You can use prints and/or breakpoints to see what is wrong.

1 answer

MarketplaceService is a thing that needs to be done through ServerScript(AKA. Normal Script) but looks like you are trying to access it via LocalScript.--- Although, if you are using a normal script, ServerScripts can't reach game.Players.LocalPlayer because there is no such property named "LocalPlayer" for server.

EDIT: Looks like it can be accessed via LocalScript too. Can you describe what actually doesn't work in your code so we can help? You can use prints and/or breakpoints to see what is wrong.

6 comments

0

Wrong.

2

Actually, not wrong. Just cause ur a mod doesnt mean go around yelling Wrong whenever someone gets something slightly incorrect.

0

Thanks Sblankthorn. @incapaz can you tell me what did I do wrong? I do not mind getting downvoted and getting a review, but I would like to know what did I do wrong so I can learn too.

0

@SBlank I am not a mod. And I am not wrong either. The Marketplace service is NOT server-side only. Its events such as PromptPurchaseFinished are.

0

@Incapaz I was talking about you saying "ServerScripts can't reach game.Players.LocalPlayer". And dont attempt to defend yourself by saying "I didn't." because maybe YOU should edit YOUR post that says "Wrong" and broaden your reasons for saying wrong, and actually HELP this person, and not just calling them out for being incorrect. And you're not a mod

0

facepalm This is the ANSWER, not the question. The answerer is the helper.

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