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
 

Script Help. Probably Something Simple...

Previous Thread :: Next Thread 
GUESTHAXX is not online. 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
Swordphin123 is not online. Swordphin123
Joined: 09 Apr 2008
Total Posts: 5234
01 Aug 2012 03:08 PM
Keep adding onto the connection line.
Report Abuse
GUESTHAXX is not online. GUESTHAXX
Joined: 16 Apr 2012
Total Posts: 3370
01 Aug 2012 03:11 PM
May I have an example?
Report Abuse
UberGiantBuilder is not online. UberGiantBuilder
Joined: 08 Jul 2012
Total Posts: 1233
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 is not online. 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
UberGiantBuilder is not online. UberGiantBuilder
Joined: 08 Jul 2012
Total Posts: 1233
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 is not online. 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
UberGiantBuilder is not online. UberGiantBuilder
Joined: 08 Jul 2012
Total Posts: 1233
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 is not online. 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
UberGiantBuilder is not online. UberGiantBuilder
Joined: 08 Jul 2012
Total Posts: 1233
01 Aug 2012 04:01 PM
I'm sorry im not sure how to do shops either.... wish I could help.
Report Abuse
GUESTHAXX is not online. 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
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