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: Shop GUI

Previous Thread :: Next Thread 
KodakKid3 is not online. KodakKid3
Joined: 25 Dec 2008
Total Posts: 2860
09 Mar 2014 01:52 PM
I have a leaderboard that gives players money for doing things ingame. The money value is just called "Money". I made a gui that I want to use as a shop (The script would go inside a TextButton).

In Lighting is a tool called PowerShot, which I want to give to the player when he uses the shop for it (For 900 money).

This is the script I wrote:

local Mon = Player.Money.Value
local PS = game.Lighting.PowerShot

function onClick()
if Mon >= 900 then
Mon = Mon - 900
--give player PS
end
end

MouseButton1Down:connect(onClick)

I obviously don't know what I'm doing.

Help?
Report Abuse
MARIOSTAR6464 is not online. MARIOSTAR6464
Joined: 21 Jul 2008
Total Posts: 13674
09 Mar 2014 01:54 PM
Connection line is the problem. Determin what is being clicked.


function onClick()
if Mon >= 900 then
Mon = Mon - 900
--give player PS
end
end

*PUT THE THING BEING CLICKED HERE*.MouseButton1Down:connect(onClick)
Report Abuse
ThrashingThunder is not online. ThrashingThunder
Joined: 03 Oct 2011
Total Posts: 2388
09 Mar 2014 01:54 PM
Uh, no...


--Goes into LocalScript, in the text button

KeepGear = false --Do you want them to keep it when they die? If so, set to true.

function onClicked()
if game.Players.LocalPlayer.leaderstats.Money.Value >= 900 then
game.Lighting["Power Shot"]:Clone().Parent = game.Players.LocalPlayer.Backpack
if KeepGear == true then
game.Lighting["Power Shot"]:Clone().Parent = game.Players.LocalPlayer.StarterGear
end
end
end
script.Parent.Clicked:connect(onClicked)
Report Abuse
KodakKid3 is not online. KodakKid3
Joined: 25 Dec 2008
Total Posts: 2860
09 Mar 2014 02:40 PM
Thanks.

Thrashing, yours looks good (Not currently working), I'll see if I can fix whatever's wrong.
Report Abuse
ThrashingThunder is not online. ThrashingThunder
Joined: 03 Oct 2011
Total Posts: 2388
09 Mar 2014 05:01 PM
It was the connection line, replace it with this:

script.Parent.MouseButton1Click:connect(onClicked)
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