generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Script won't work

Previous Thread :: Next Thread 
wayne2018 is not online. wayne2018
Joined: 04 Jun 2014
Total Posts: 2509
24 Jan 2016 12:51 AM
Doesn't work for some reason

local buyButton = script.Parent
local productId = 31361987 --change to dev product id
local mps = game:GetService"MarketplaceService"

function getPlayerById(id)
for i,v in pairs(game.Players:GetPlayers()) do
if v.userId == id then
return v
end
end
end

buyButton.MouseButton1Click:connect(function()
mps:PromptProductPurchase(game.Players.LocalPlayer, productId)
end)

mps.ProcessReceipt = function(info)
local plr = getPlayerById(info.PlayerId)
if plr and plr:FindFirstChild"leaderstats" and plr.leaderstats:FindFirstChild"Coins" then
plr.leaderstats.Coins.Value = plr.leaderstats.Coins.Value + 50
end
end
Report Abuse
wayne2018 is not online. wayne2018
Joined: 04 Jun 2014
Total Posts: 2509
24 Jan 2016 01:00 AM
Bump
Report Abuse
seanb117 is not online. seanb117
Joined: 03 Feb 2010
Total Posts: 1020
24 Jan 2016 01:05 AM
Script output?
Report Abuse
wayne2018 is not online. wayne2018
Joined: 04 Jun 2014
Total Posts: 2509
24 Jan 2016 01:15 AM
What do you mean?
Report Abuse
spinywind is online. spinywind
Joined: 26 Jan 2012
Total Posts: 3580
24 Jan 2016 01:24 AM
Did u free model it, cause if you dont know what a script output is by now and your that far into scripting its hard to believe. A script output is an output that tells locates errors in scripts when you test in studio. Thats why many scripters like to put prints in between the scripts so if it breaks they know where because it prints in the output and u can find were the last print was and then stopped.


Report Abuse
seanb117 is not online. seanb117
Joined: 03 Feb 2010
Total Posts: 1020
24 Jan 2016 01:24 AM
Output is a window used for script debugging. It's like Explorer sorta. It will tell you (in most cases) why a script isn't working.
Report Abuse
wayne2018 is not online. wayne2018
Joined: 04 Jun 2014
Total Posts: 2509
24 Jan 2016 01:40 AM
"Did u free model it"
Well, yes. I was studying different free models for their code/scripts and came upon this model that doesn't work. I dug through the scripts and it looked fine to me. It was really bugging me to find out why it doesn't work so that's why I'm here. Hopefully I won't get too much hate for this...
Report Abuse
spinywind is online. spinywind
Joined: 26 Jan 2012
Total Posts: 3580
24 Jan 2016 01:42 AM
Well you admit it so you really shouldn't


Report Abuse
wayne2018 is not online. wayne2018
Joined: 04 Jun 2014
Total Posts: 2509
24 Jan 2016 01:45 AM
I just checked the output and nothing came up.
Report Abuse
spinywind is online. spinywind
Joined: 26 Jan 2012
Total Posts: 3580
24 Jan 2016 01:46 AM
what are you trying to do exactly when a person buys the product?



Report Abuse
spinywind is online. spinywind
Joined: 26 Jan 2012
Total Posts: 3580
24 Jan 2016 01:46 AM
o


Report Abuse
spinywind is online. spinywind
Joined: 26 Jan 2012
Total Posts: 3580
24 Jan 2016 01:51 AM


local plr = script.Parent.Parent.Parent.Parent.Parent.Parent
local link = game:GetService("MarketplaceService")
deb = 0


script.Parent.MouseButton1Click:connect(function()
local marketId = 31361987

link:PromptProductPurchase(plr,marketId)
link.ProcessReceipt = function(receiptInfo)
if Enum.ProductPurchaseDecision.PurchaseGranted and receiptInfo.PlayerId == plr.userId then
if deb == 0 then
deb = 1
plr.leaderstats.Coins.Value = plr.leaderstats.Coins.Value + 50
deb = 0
end
end
end
end)


Report Abuse
spinywind is online. spinywind
Joined: 26 Jan 2012
Total Posts: 3580
24 Jan 2016 01:52 AM
edit the parents in which the script is located


Report Abuse
spinywind is online. spinywind
Joined: 26 Jan 2012
Total Posts: 3580
24 Jan 2016 01:53 AM
Forgot to mention, put this in a server script not a local script.


Report Abuse
wayne2018 is not online. wayne2018
Joined: 04 Jun 2014
Total Posts: 2509
24 Jan 2016 02:06 AM
Still can't get it to work ;-;
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image