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 » Scripting Helpers
Home Search
 

Re: Really weird thing happened...

Previous Thread :: Next Thread 
youssef04 is not online. youssef04
Joined: 22 Jan 2011
Total Posts: 1745
19 May 2014 04:33 PM
Ok, so I have 2 scripts. One is supposed to work a on a brick for a surface GUI, the other is a normal screen GUI, the normal GUI one doesn't work, but it's the same concept... Here is the script:

SCRIPT FOR BRICK
local buyButton = game.Workspace.BuyButton.SurfaceGui.TextButton
local productId = 19860147
buyButton.MouseButton1Click:connect(function()
Game:GetService("MarketplaceService"):PromptProductPurchase(game.Players.LocalPlayer, productId)
end)

SCRIPT FOR GUI:
local buyButton = game.StarterGui.ScreenGui.TextButton
local productId = 19860147
buyButton.MouseButton1Click:connect(function()
Game:GetService("MarketplaceService"):PromptProductPurchase(game.Players.LocalPlayer, productId)
end)
Report Abuse
youssef04 is not online. youssef04
Joined: 22 Jan 2011
Total Posts: 1745
20 May 2014 11:13 AM
B1
Report Abuse
davisky2 is not online. davisky2
Joined: 04 Mar 2012
Total Posts: 4710
20 May 2014 12:13 PM
or you i thought you know more than this xD
Report Abuse
davisky2 is not online. davisky2
Joined: 04 Mar 2012
Total Posts: 4710
20 May 2014 12:14 PM
for*
Report Abuse
youssef04 is not online. youssef04
Joined: 22 Jan 2011
Total Posts: 1745
20 May 2014 12:35 PM
Hold on..
Does this need to be PlayerGui?
Report Abuse
TheLuaUser is not online. TheLuaUser
Joined: 22 May 2012
Total Posts: 1405
20 May 2014 12:39 PM
Youssef, the script's not working because the path to buybutton is in StarterGui.
StarterGui is a service that transfers it's children to the player's PlayerGui whenever they respawn.

So try putting that script on the button and replacing the buybutton path with "script.Parent".
Report Abuse
youssef04 is not online. youssef04
Joined: 22 Jan 2011
Total Posts: 1745
20 May 2014 12:40 PM
I'll try that method :3
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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