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: Can someone help me with this shop gui?

Previous Thread :: Next Thread 
Princebucket is not online. Princebucket
Joined: 19 Oct 2013
Total Posts: 1481
01 May 2015 03:02 PM
plr = script.Parent.Parent.Parent.Parent.Parent
price = 0
script.Parent.MouseButton1Click:connect(function()
local v = plr.leaderstats.Money
if v.Money.Value <= price then
game.Lighting.Narsil:clone().Parent = plr.Backpack
v.Money.Value = v.Money.Value - price
end

end)

--I made it 0 so I could test it, the currency is Money
this is the leaderstat script
game.Players.PlayerAdded:connect(function(Player)
stats = Instance.new("IntValue", Player)
stats.Name = "leaderstats"

money = Instance.new("IntValue", stats)
money.Name = "Money"

end)
-- the tool is called "Narsil"
Report Abuse
Princebucket is not online. Princebucket
Joined: 19 Oct 2013
Total Posts: 1481
01 May 2015 03:06 PM
I want to press the button and it will add the sword
Report Abuse
Klink45 is not online. Klink45
Joined: 06 Jun 2011
Total Posts: 26054
01 May 2015 03:08 PM
Add something like this:

local sword = sword:clone()
sword.Parent = game.Players.LocalPlayer.StartGear

Report Abuse
Princebucket is not online. Princebucket
Joined: 19 Oct 2013
Total Posts: 1481
01 May 2015 03:11 PM
at the end?
i really am not good at lua.
Report Abuse
Klink45 is not online. Klink45
Joined: 06 Jun 2011
Total Posts: 26054
01 May 2015 03:15 PM
No at the part where you buy the sword.
Report Abuse
Princebucket is not online. Princebucket
Joined: 19 Oct 2013
Total Posts: 1481
01 May 2015 03:17 PM
after this, ty for all ur help btw i didnt know people here actually cared about newbags like me
if v.Money.Value <= price then
Report Abuse
Klink45 is not online. Klink45
Joined: 06 Jun 2011
Total Posts: 26054
01 May 2015 03:18 PM
Yes, and also make sure you change sword to what your sword's name is.
Report Abuse
Klink45 is not online. Klink45
Joined: 06 Jun 2011
Total Posts: 26054
01 May 2015 03:19 PM
Or item.
Idk why I said "sword." :P
Report Abuse
Princebucket is not online. Princebucket
Joined: 19 Oct 2013
Total Posts: 1481
01 May 2015 03:20 PM
doesn't work, It comes up with
Money is not a valid member of IntValue
when I put it in as it e.e
Report Abuse
Klink45 is not online. Klink45
Joined: 06 Jun 2011
Total Posts: 26054
01 May 2015 03:23 PM
Here, try this:

local plr = script.Parent.Parent.Parent.Parent.Parent
local price = 0
script.Parent.MouseButton1Click:connect(function()
local v = plr.leaderstats.Money
if v.Money.Value <= price then
local Item = game.Lighting.Narsil:Clone()
Item.Parent = game.Players.LocalPlayer.StarterGear --Keeps the tool after respawning.
local Item = game.Lighting.Narsil:Clone() --Probably not the best way to do this.
Item.Parent = game.Players.LocalPlayer.StarterPack
end

end)

--I made it 0 so I could test it, the currency is Money
this is the leaderstat script
game.Players.PlayerAdded:connect(function(Player)
stats = Instance.new("IntValue", Player)
stats.Name = "leaderstats"

money = Instance.new("IntValue", stats)
money.Name = "Money"

end)
-- the tool is called "Narsil"
Report Abuse
Princebucket is not online. Princebucket
Joined: 19 Oct 2013
Total Posts: 1481
01 May 2015 03:33 PM
doesn't work e.e
I'm probably doing it wrong though, sorry for bothering you, just trying to learn LUA
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