Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How i make a developer product script?

Asked by 5 years ago
Edited 5 years ago

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)
0
i belive it cant be in a local script mattchew1010 396 — 5y
0
it is a localscript DontGetTired255 6 — 5y
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. superalp1111 662 — 5y

1 answer

Log in to vote
2
Answered by 5 years ago
Edited 5 years ago

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.

0
Wrong. User#19524 175 — 5y
2
Actually, not wrong. Just cause ur a mod doesnt mean go around yelling Wrong whenever someone gets something slightly incorrect. SBlankthorn 329 — 5y
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. superalp1111 662 — 5y
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. User#19524 175 — 5y
View all comments (2 more)
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 SBlankthorn 329 — 5y
0
*facepalm* This is the ANSWER, not the question. The answerer is the helper. User#19524 175 — 5y
Ad

Answer this question