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 |
|
|
| |
|
|
| 10 Nov 2012 06:57 PM |
Could you direct us to the line that is breaking your code?
- thedestroyer115 |
|
|
| Report Abuse |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 10 Nov 2012 08:55 PM |
Did you read my other post? Tell me the output.
- thedestroyer115 |
|
|
| Report Abuse |
|
|