nGenuity
|
  |
| Joined: 01 May 2009 |
| Total Posts: 339 |
|
|
| 24 Apr 2017 04:25 PM |
FishBuyer = script.Parent GoldForFish = 5
function sellFish(player)
local money = player.leaderstats.money local Fish = player.leaderstats.Fish
if Fish.Value > 0 then Fish.Value = Fish.Value - 1 money.Value = money.Value + GoldForFish end
end
FishBuyer.ClickDetector.MouseClick:Connect(sellFish)
Says in output that money is not a member of Model |
|
|
| Report Abuse |
|
|
|
| 24 Apr 2017 04:26 PM |
isn't that self explanatory?
what's the problem here?
|
|
|
| Report Abuse |
|
|
nGenuity
|
  |
| Joined: 01 May 2009 |
| Total Posts: 339 |
|
|
| 24 Apr 2017 04:29 PM |
I don't understand how to put money into modeL?!
The script for this is in a brick and the leaderstats are in the workspace I don't see the problem? so no it isn't, not to me. |
|
|
| Report Abuse |
|
|
|
| 24 Apr 2017 04:35 PM |
the "money" object does not exist in that model
did you ever create it?
|
|
|
| Report Abuse |
|
|
nGenuity
|
  |
| Joined: 01 May 2009 |
| Total Posts: 339 |
|
|
| 24 Apr 2017 04:50 PM |
| No I never created an object called money, i assumed it pulled the code from leaderstats and made changes to it. |
|
|
| Report Abuse |
|
|
nGenuity
|
  |
| Joined: 01 May 2009 |
| Total Posts: 339 |
|
|
| 24 Apr 2017 06:30 PM |
Bump
Can someone point me in the right direction? |
|
|
| Report Abuse |
|
|
|
| 24 Apr 2017 06:55 PM |
| Is the name of the stat "money" or "Money"? Everything's case sensitive. |
|
|
| Report Abuse |
|
|
nGenuity
|
  |
| Joined: 01 May 2009 |
| Total Posts: 339 |
|
|
| 24 Apr 2017 07:17 PM |
The leader stats is a script in workspace it is the leadboard it has "money" and "fish"
So do I need to add another object into the brick containing the click detectorscript called money for it to affect the leaderboard stats? |
|
|
| Report Abuse |
|
|
|
| 24 Apr 2017 10:15 PM |
| I'm just asking if they're named correctly. If the name of the stat is "Money" and you're trying to index player.leaderstats.money it's going to cause an error. |
|
|
| Report Abuse |
|
|
nGenuity
|
  |
| Joined: 01 May 2009 |
| Total Posts: 339 |
|
|
| 24 Apr 2017 10:42 PM |
| Yes they are all named correctly. |
|
|
| Report Abuse |
|
|
| |
|
nGenuity
|
  |
| Joined: 01 May 2009 |
| Total Posts: 339 |
|
| |
|
|
| 24 Apr 2017 11:23 PM |
what does the output say copy all of it
|
|
|
| Report Abuse |
|
|
nGenuity
|
  |
| Joined: 01 May 2009 |
| Total Posts: 339 |
|
|
| 24 Apr 2017 11:27 PM |
00:25:50.583 - money is not a valid member of Model 00:25:50.584 - Stack Begin 00:25:50.584 - Script 'Workspace.FishBuyer.Script', Line 7 00:25:50.584 - Stack End 00:25:50.819 - money is not a valid member of Model 00:25:50.820 - Stack Begin 00:25:50.820 - Script 'Workspace.FishBuyer.Script', Line 7 00:25:50.820 - Stack End 00:25:51.286 - money is not a valid member of Model 00:25:51.287 - Stack Begin 00:25:51.287 - Script 'Workspace.FishBuyer.Script', Line 7 00:25:51.287 - Stack End |
|
|
| Report Abuse |
|
|
|
| 24 Apr 2017 11:46 PM |
| Are you sure that money is there when the script activates |
|
|
| Report Abuse |
|
|
|
| 24 Apr 2017 11:47 PM |
Listen is it called money and fish or Money and Fish?
Also have you tried the script I gave you on the other post about this because I did test my script and it does work. |
|
|
| Report Abuse |
|
|
nGenuity
|
  |
| Joined: 01 May 2009 |
| Total Posts: 339 |
|
|
| 25 Apr 2017 12:00 AM |
Literally Here is my leaderstats script:
game.Players.PlayerAdded:connect(function(player) local leaderstats = Instance.new("Model", player) leaderstats.Name = "leaderstats" local money = Instance.new("IntValue", leaderstats) money.Name = "Gold" money.Value = 0
local Fish = Instance.new("IntValue", leaderstats) Fish.Name = "Fish" Fish.Value = 1 end)
here is my fishbuyer script:
FishBuyer = script.Parent GoldForFish = 5
function sellFish(player)
local money = player.leaderstats.money local Fish = player.leaderstats.Fish
if Fish.Value > 0 then Fish.Value = Fish.Value - 1 money.Value = money.Value + GoldForFish elseif Fish.Value < 1 then Fish.Value = Fish.Value end
end
FishBuyer.ClickDetector.MouseClick:Connect(sellFish)
@128 What code? |
|
|
| Report Abuse |
|
|
Dratik
|
  |
| Joined: 13 Nov 2008 |
| Total Posts: 36385 |
|
|
| 25 Apr 2017 12:03 AM |
Change the text from "money" to Gold.
It searches for what the name is under the leaderstats, not under the leaderboard script
|
|
|
| Report Abuse |
|
|
nGenuity
|
  |
| Joined: 01 May 2009 |
| Total Posts: 339 |
|
|
| 25 Apr 2017 12:03 AM |
| @128 Your other code subtracted my fish but gave me no gold under money stat. |
|
|
| Report Abuse |
|
|
Dratik
|
  |
| Joined: 13 Nov 2008 |
| Total Posts: 36385 |
|
|
| 25 Apr 2017 12:04 AM |
this block, for further explanation
local money = Instance.new("IntValue", leaderstats) money.Name = "Gold" ---- this is why you change it to Gold and not money money.Value = 0
|
|
|
| Report Abuse |
|
|
nGenuity
|
  |
| Joined: 01 May 2009 |
| Total Posts: 339 |
|
|
| 25 Apr 2017 12:06 AM |
| I Fixed it, Thank you for the help everyone. |
|
|
| Report Abuse |
|
|
|
| 25 Apr 2017 12:06 AM |
| Thats because your money is called gold not money. |
|
|
| Report Abuse |
|
|
|
| 25 Apr 2017 12:47 AM |
| To think this took an entire day to resolve... |
|
|
| Report Abuse |
|
|