|
| 27 Sep 2014 12:27 PM |
Does anyone know what's wrong with this? I asked for help earlier but It seemed that the few people helping me we not really fixing my main problem with this code. Their is no error so I really honestly don't know the issue. If anyone could figure this out that would be amazing!
Event.OnServerEvent:connect(function(Player, ...) if Player then local tuple = {...} if tuple[1] == "Bought1" then if tuple[2] == "Upgrade1" then local DataCollection = PlayerData[Player.userId] if DataCollection and DataCollection.Cash >= 4 then AwardCash(Player, -4) end elseif tuple[2] == "Upgrade2" then local DataCollection = PlayerData[Player.userId] if DataCollection and DataCollection.Cash >= 7 then AwardCash(Player, -7) end elseif tuple[2] == "Upgrade3" then local DataCollection = PlayerData[Player.userId] if DataCollection and DataCollection.Cash >= 12 then AwardCash(Player, -12) end elseif tuple[2] == "Upgrade4" then local DataCollection = PlayerData[Player.userId] if DataCollection and DataCollection.Cash >= 16 then AwardCash(Player, -16) end elseif tuple[2] == "Upgrade5" then local DataCollection = PlayerData[Player.userId] if DataCollection and DataCollection.Cash >= 21 then AwardCash(Player, -21) end elseif tuple[2] == "Upgrade6" then local DataCollection = PlayerData[Player.userId] if DataCollection and DataCollection.Cash >= 9 then AwardCash(Player, -9) end elseif tuple[2] == "Upgrade7" then local DataCollection = PlayerData[Player.userId] if DataCollection and DataCollection.Cash >= 15 then AwardCash(Player, -15) end elseif tuple[2] == "Upgrade8" then local DataCollection = PlayerData[Player.userId] if DataCollection and DataCollection.Cash >= 19 then AwardCash(Player, -19) end elseif tuple[2] == "Upgrade9" then local DataCollection = PlayerData[Player.userId] if DataCollection and DataCollection.Cash >= 36 then AwardCash(Player, -36) end elseif tuple[2] == "Upgrade10" then local DataCollection = PlayerData[Player.userId] if DataCollection and DataCollection.Cash >= 48 then AwardCash(Player, -48) end end elseif tuple[1] == "Bought2" then if tuple[2] == "Texture1" then local DataCollection = PlayerData[Player.userId] if DataCollection and DataCollection.Cash >= 3 then AwardCash(Player, -3) end elseif tuple[2] == "Texture2" then local DataCollection = PlayerData[Player.userId] if DataCollection and DataCollection.Cash >= 7 then AwardCash(Player, -7) end elseif tuple[2] == "Texture3" then local DataCollection = PlayerData[Player.userId] if DataCollection and DataCollection.Cash >= 9 then AwardCash(Player, -9) end elseif tuple[2] == "Texture4" then local DataCollection = PlayerData[Player.userId] if DataCollection and DataCollection.Cash >= 13 then AwardCash(Player, -13) end elseif tuple[2] == "Texture5" then local DataCollection = PlayerData[Player.userId] if DataCollection and DataCollection.Cash >= 16 then AwardCash(Player, -16) end elseif tuple[2] == "Texture6" then local DataCollection = PlayerData[Player.userId] if DataCollection and DataCollection.Cash >= 19 then AwardCash(Player, -19) end elseif tuple[2] == "Texture7" then local DataCollection = PlayerData[Player.userId] if DataCollection and DataCollection.Cash >= 23 then AwardCash(Player, -23) end elseif tuple[2] == "Texture8" then local DataCollection = PlayerData[Player.userId] if DataCollection and DataCollection.Cash >= 29 then AwardCash(Player, -29) end elseif tuple[2] == "Texture9" then local DataCollection = PlayerData[Player.userId] if DataCollection and DataCollection.Cash >= 34 then AwardCash(Player, -34) end elseif tuple[2] == "Texture10" then local DataCollection = PlayerData[Player.userId] if DataCollection and DataCollection.Cash >= 39 then AwardCash(Player, -39) end end end end end)
|
|
|
| Report Abuse |
|
|
ohno1112
|
  |
| Joined: 23 Mar 2013 |
| Total Posts: 833 |
|
|
| 27 Sep 2014 12:31 PM |
all i can advise to to put a print inbetween every line
for example:
--code print("1") --code print("2") --code print("3")
i know this is really time consuming, but its the only way to exactly see what runs and what not. that might help you detect where the script takes a wrong turn. |
|
|
| Report Abuse |
|
|
|
| 27 Sep 2014 12:34 PM |
| Nothing prints. That's another reason I made this. So I know I'm doing something wrong, I just don't know where. |
|
|
| Report Abuse |
|
|
|
| 27 Sep 2014 12:51 PM |
| I'm relying on script helpers to know what the issue is, but I guess it's just too much. |
|
|
| Report Abuse |
|
|
| |
|
BruceAB12
|
  |
| Joined: 19 Jan 2012 |
| Total Posts: 3238 |
|
|
| 27 Sep 2014 01:18 PM |
| Help us help you by telling us what it does... |
|
|
| Report Abuse |
|
|
|
| 27 Sep 2014 01:20 PM |
| It's pretty obvious, if the person has the upgrade the players cash decreases... |
|
|
| Report Abuse |
|
|
|
| 27 Sep 2014 01:21 PM |
| Upgrade or Texture. I really would love this issue to be fixed or figured out. |
|
|
| Report Abuse |
|
|
BruceAB12
|
  |
| Joined: 19 Jan 2012 |
| Total Posts: 3238 |
|
|
| 27 Sep 2014 01:21 PM |
| Are you testing this in solo? |
|
|
| Report Abuse |
|
|
|
| 27 Sep 2014 01:26 PM |
| NO. Please, I would assume this is a simple error that I cannot find. Can someone please find the mistake of mine? |
|
|
| Report Abuse |
|
|
BruceAB12
|
  |
| Joined: 19 Jan 2012 |
| Total Posts: 3238 |
|
|
| 27 Sep 2014 01:27 PM |
| What are the contents of 'local tuple = {...}' |
|
|
| Report Abuse |
|
|
|
| 27 Sep 2014 01:33 PM |
Maybe it's this? But I don't think it would...
if Upgrade1.Value == 1 then Event:FireClient(Player, "Bought1", "Upgrade1") elseif Upgrade2.Value == 1 then Event:FireClient(Player, "Bought1", "Upgrade2") elseif Upgrade3.Value == 1 then Event:FireClient(Player, "Bought1", "Upgrade3") elseif Upgrade4.Value == 1 then Event:FireClient(Player, "Bought1", "Upgrade4") elseif Upgrade5.Value == 1 then Event:FireClient(Player, "Bought1", "Upgrade5") elseif Upgrade6.Value == 1 then Event:FireClient(Player, "Bought1", "Upgrade6") elseif Upgrade7.Value == 1 then Event:FireClient(Player, "Bought1", "Upgrade7") elseif Upgrade8.Value == 1 then Event:FireClient(Player, "Bought1", "Upgrade8") elseif Upgrade9.Value == 1 then Event:FireClient(Player, "Bought1", "Upgrade9") elseif Upgrade10.Value == 1 then Event:FireClient(Player, "Bought1", "Upgrade10") elseif Texture1.Value == 1 then Event:FireClient(Player, "Bought2", "Texture1") elseif Texture2.Value == 1 then Event:FireClient(Player, "Bought2", "Texture2") elseif Texture3.Value == 1 then Event:FireClient(Player, "Bought2", "Texture3") elseif Texture4.Value == 1 then Event:FireClient(Player, "Bought2", "Texture4") elseif Texture5.Value == 1 then Event:FireClient(Player, "Bought2", "Texture5") elseif Texture6.Value == 1 then Event:FireClient(Player, "Bought2", "Texture6") elseif Texture7.Value == 1 then Event:FireClient(Player, "Bought2", "Texture7") elseif Texture8.Value == 1 then Event:FireClient(Player, "Bought2", "Texture8") elseif Texture9.Value == 1 then Event:FireClient(Player, "Bought2", "Texture9") elseif Texture10.Value == 1 then Event:FireClient(Player, "Bought2", "Texture10") end |
|
|
| Report Abuse |
|
|
|
| 27 Sep 2014 01:33 PM |
| When I say maybe it's this, I mean maybe this is the issue. But I would not assure that. |
|
|
| Report Abuse |
|
|
BruceAB12
|
  |
| Joined: 19 Jan 2012 |
| Total Posts: 3238 |
|
| |
|
| |
|
BruceAB12
|
  |
| Joined: 19 Jan 2012 |
| Total Posts: 3238 |
|
|
| 27 Sep 2014 01:37 PM |
So you said that even the 'print()' function isn't working? |
|
|
| Report Abuse |
|
|
|
| 27 Sep 2014 01:39 PM |
| Its not printing. So it has something to do with the code. I just don't know where. I know that the print() function works cause it works within other content of the script, but within that code, no it does not work. |
|
|
| Report Abuse |
|
|
BruceAB12
|
  |
| Joined: 19 Jan 2012 |
| Total Posts: 3238 |
|
|
| 27 Sep 2014 01:46 PM |
Debug your code using breakpoints
http://wiki.roblox.com/index.php?title=Lua_debugger |
|
|
| Report Abuse |
|
|
|
| 27 Sep 2014 01:49 PM |
| I'm going to point out that either this is not messed up or no one knows the issue just by looking at it. But, I will go ahead and debug it again using breakpoints and if their are any errors I will let you know. Thanks. |
|
|
| Report Abuse |
|
|