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

Re: Why won't this work?

Previous Thread :: Next Thread 
redfart is not online. redfart
Joined: 17 Oct 2008
Total Posts: 1021
10 Nov 2012 06:27 PM
The "Name" Part of it all does not work. The output says:

19:26:40 - Players.Player1.PlayerGui.Store.Backpack.P90.ShopButton:5: bad argument #2 to '?' (string expected, got nil)
19:26:40 - Script "Players.Player1.PlayerGui.Store.Backpack.P90.ShopButton", Line 5
19:26:40 - stack end

The Name value is a string value, by the way. Here's the script:




player = script.Parent.Parent.Parent.Parent.Parent
credits = player.leaderstats.Credits
price = script.Parent.Cost.Value
name = script.Parent.Name.Value
tool = game.Lighting[script.Parent.Name.Value]


function buy()
if player.Backpack:FindFirstChild(name) == nil then
if credits.Value >= price then
credits.Value = credits.Value - price
local a = tool:clone()
a.Parent = player.Backpack
local b = tool:clone()
b.Parent = player.StarterGear
else print("You already have one!")
end
end
end

script.Parent.MouseButton1Down:connect(buy)
Report Abuse
ExoticEpicNinja is not online. ExoticEpicNinja
Joined: 06 Mar 2012
Total Posts: 4186
10 Nov 2012 06:52 PM
IDK DUN8 PL0X pls
Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
10 Nov 2012 06:57 PM
Could you direct us to the line that is breaking your code?

- thedestroyer115
Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
10 Nov 2012 07:00 PM
Nvm. Put this below all your global variable declerations.


print(player, credits, price, name, tool)


And change this:


if player.Backpack:FindFirstChild(name) == nil then


to this:


if not player.Backpack:FindFirstChild(name) then


- thedestroyer115
Report Abuse
coolc3320 is not online. coolc3320
Joined: 13 Jun 2012
Total Posts: 328
10 Nov 2012 08:39 PM
I'm not sure and sorry if it dosen't help.
Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
10 Nov 2012 08:55 PM
Did you read my other post? Tell me the output.

- thedestroyer115
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Building 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