GUESTHAXX
|
  |
| Joined: 16 Apr 2012 |
| Total Posts: 3370 |
|
|
| 01 Aug 2012 03:05 PM |
How do I control several GUI buttons through on script? I have a shop GUI...
Here's what script is in EVERY GUI button:
-- Made by GuestHaxx player = script.Parent.Parent.Parent.Parent.Parent Caps = player.GuiStats.Caps -- Change Caps to the money you want to be used to buy the item CapPrice = 100 -- Your price goes here Lead = player.GuiStats.Lead LeadPrice = 100 -- Your price goes here --[[?What goes here?]]-- tool = game.Lighting:findFirstChild("FlameThrower") --Just a test weapon.
--NOTE: Change "tool" to the tools name... --It takes "Caps" to buy the tool...
function buy() if Caps.Value >= CapPrice and Lead.Value >= LeadPrice then Caps.Value = Caps.Value - CapPrice Lead.Value = Lead.Value - LeadPrice local a = tool:clone() a.Parent = player.Backpack local b = tool:clone() b.Parent = player.StarterGear end end script.Parent.MouseButton1Down:connect(buy)
Please help.
|
|
|
| Report Abuse |
|
|
|
| 01 Aug 2012 03:08 PM |
| Keep adding onto the connection line. |
|
|
| Report Abuse |
|
|
GUESTHAXX
|
  |
| Joined: 16 Apr 2012 |
| Total Posts: 3370 |
|
| |
|
|
| 01 Aug 2012 03:15 PM |
I'm assuming you borrowed this, or you're making it for a friend.
Anyways what is the problem and is there and output? |
|
|
| Report Abuse |
|
|
GUESTHAXX
|
  |
| Joined: 16 Apr 2012 |
| Total Posts: 3370 |
|
|
| 01 Aug 2012 03:26 PM |
No and no.
I scripted this myself. But I'm new to scripting...
Output none.
Problem:
I don't know exactly what I'm needing to do to make the Script run all the buttons. |
|
|
| Report Abuse |
|
|
|
| 01 Aug 2012 03:29 PM |
Im sorry for not reading but.
Answer these
So what are the buttons going to do Have you defined what they do in the script.
Looks like a shop kinda thing to me. |
|
|
| Report Abuse |
|
|
GUESTHAXX
|
  |
| Joined: 16 Apr 2012 |
| Total Posts: 3370 |
|
|
| 01 Aug 2012 03:37 PM |
If you read the script then you would know its a shop...
Yes its a shop.
Buttons will allow you to buy things (tools)
"Have you defined what they do in the script."
/\ I don't think I have.
|
|
|
| Report Abuse |
|
|
|
| 01 Aug 2012 03:55 PM |
Well I'm not exactly sure but I have a script that does that if you can do this yourself heres what you need in a part of it
check which button was clicked check is players currency value is good enough clone item from lighting into players backpack(if its a tool) end end --however many ends
Hopefully you can do that because my gui weapon thing doesnt fit yours because its not a shop |
|
|
| Report Abuse |
|
|
GUESTHAXX
|
  |
| Joined: 16 Apr 2012 |
| Total Posts: 3370 |
|
|
| 01 Aug 2012 03:57 PM |
"check which button was clicked check is players currency value is good enough"
/\ So thats what I need to do... D: :/ :( I don't know how to do that. |
|
|
| Report Abuse |
|
|
|
| 01 Aug 2012 04:01 PM |
| I'm sorry im not sure how to do shops either.... wish I could help. |
|
|
| Report Abuse |
|
|
GUESTHAXX
|
  |
| Joined: 16 Apr 2012 |
| Total Posts: 3370 |
|
|
| 01 Aug 2012 04:06 PM |
Do you know anyone who's good at it?
Also... Here's a cleaner script: (same but longer and cleaner.)
Alright I'm just going to add things to this...
player = script.Parent.Parent.Parent.Parent.Parent
-- Resource List
Caps = player.GuiStats.Caps
Lead = player.GuiStats.Lead
Metal = player.GuiStats.Metal
TinCan = player.GuiStats.Tin Cans
SAmmoCasings = player.GuiStats.Small Ammo Casings
LAmmoCasings = player.GuiStats.Large Ammo Casings
Nails = player.GuiStats.Nails
Spear = player.GuiStats.Spear
Knife = player.GuiStats.Knife
EBottle = player.GuiStats.Empty Bottle
Electronics = player.GuiStats.Scrap Electronics
FB = player.GuiStats.Fusion Battery
--Price List
CapPrice =
LeadPrice =
MetalPrice =
TinCanPrice =
SAmmoCasingsPrice =
LAmmoCasingsPrice =
NailsPrice = --lol
SpearPrice = --Ouchy
KnifePrice =
EbottlePrice =
ElectronicsPrice = --ZAAAAAPPPP
FBPrice = --FB is worth 4bill if I remember...
--Tool list
FlameThrower = game.Lighting:findFirstChild("FlameThrower") --Keep the name the same...
M82A1 = game.Lighting:findFirstChild("M82A1")
AssaultRifle = game.Lighting:findFirstChild("Assault Rifle")
FourFiveAutoPistol = game.Lighting:findFirstChild(".45 Auto[6]")
Weaponname = game.Lighting:findFirstChild("")
Weaponname = game.Lighting:findFirstChild("")
Weaponname = game.Lighting:findFirstChild("")
Weaponname = game.Lighting:findFirstChild("")
Weaponname = game.Lighting:findFirstChild("")
--Buy list, need to scrap this soon. Or you can help.
function buy() if Caps.Value >= CapPrice and Lead.Value >= LeadPrice then Caps.Value = Caps.Value - CapPrice Lead.Value = Lead.Value - LeadPrice local a = tool:clone() a.Parent = player.Backpack local b = tool:clone() b.Parent = player.StarterGear end end script.Parent.MouseButton1Down:connect(buy)
|
|
|
| Report Abuse |
|
|