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: Script won't work

Previous Thread :: Next Thread 
nGenuity is online. 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
memorycode is not online. memorycode
Joined: 24 Sep 2011
Total Posts: 3322
24 Apr 2017 04:26 PM
isn't that self explanatory?

what's the problem here?


Report Abuse
nGenuity is online. 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
memorycode is not online. memorycode
Joined: 24 Sep 2011
Total Posts: 3322
24 Apr 2017 04:35 PM
the "money" object does not exist in that model

did you ever create it?


Report Abuse
nGenuity is online. 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 is online. 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
Mister_Manakin is not online. Mister_Manakin
Joined: 16 Sep 2009
Total Posts: 1935
24 Apr 2017 06:55 PM
Is the name of the stat "money" or "Money"? Everything's case sensitive.
Report Abuse
nGenuity is online. 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
Mister_Manakin is not online. Mister_Manakin
Joined: 16 Sep 2009
Total Posts: 1935
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 is online. nGenuity
Joined: 01 May 2009
Total Posts: 339
24 Apr 2017 10:42 PM
Yes they are all named correctly.
Report Abuse
TsunaSenpai is not online. TsunaSenpai
Joined: 19 Jul 2012
Total Posts: 685
24 Apr 2017 10:49 PM
is leaderstats a model?
Report Abuse
nGenuity is online. nGenuity
Joined: 01 May 2009
Total Posts: 339
24 Apr 2017 10:55 PM
It is not.
Report Abuse
TsunaSenpai is not online. TsunaSenpai
Joined: 19 Jul 2012
Total Posts: 685
24 Apr 2017 11:23 PM
what does the output say copy all of it
Report Abuse
nGenuity is online. 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
TsunaSenpai is not online. TsunaSenpai
Joined: 19 Jul 2012
Total Posts: 685
24 Apr 2017 11:46 PM
Are you sure that money is there when the script activates
Report Abuse
128Gigabytes is not online. 128Gigabytes
Joined: 17 Apr 2014
Total Posts: 3616
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 is online. 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 is online. 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 is online. 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 is online. 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 is online. 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
128Gigabytes is not online. 128Gigabytes
Joined: 17 Apr 2014
Total Posts: 3616
25 Apr 2017 12:06 AM
Thats because your money is called gold not money.
Report Abuse
Mister_Manakin is not online. Mister_Manakin
Joined: 16 Sep 2009
Total Posts: 1935
25 Apr 2017 12:47 AM
To think this took an entire day to resolve...
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