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: Argument 1 Missing or Nill

Previous Thread :: Next Thread 
Trestin4 is not online. Trestin4
Joined: 11 Oct 2012
Total Posts: 285
08 Jan 2017 06:31 PM
So I have a script that should give money to the desired player when a button is clicked, but it says that Line 4's Argument is missing or nil. Any sollutions?

function onClicked()
local amt = script.Parent.Parent.Parent.Amt.Cash.Text
local name = script.Parent.Parent.Parent.Amt.Name.Text
local plr = game.Players:FindFirstChild(name)
local cash = plr.ActualMoney.Value
cash = cash + amt
end
script.Parent.MouseButton1Down:connect(onClicked)
Report Abuse
Trestin4 is not online. Trestin4
Joined: 11 Oct 2012
Total Posts: 285
08 Jan 2017 06:38 PM
b
Report Abuse
spot9110 is online. spot9110
Joined: 05 Dec 2009
Total Posts: 475
08 Jan 2017 06:40 PM
debug and try this to see if name is even a player
print(name)
Report Abuse
Trestin4 is not online. Trestin4
Joined: 11 Oct 2012
Total Posts: 285
08 Jan 2017 06:41 PM
It says nil
Report Abuse
Trestin4 is not online. Trestin4
Joined: 11 Oct 2012
Total Posts: 285
08 Jan 2017 06:44 PM
b
Report Abuse
spot9110 is online. spot9110
Joined: 05 Dec 2009
Total Posts: 475
08 Jan 2017 06:46 PM
then your problem is within these two lines of code
local amt = script.Parent.Parent.Parent.Amt.Cash.Text
local name = script.Parent.Parent.Parent.Amt.Name.Text

name may actually not be where you have it set at above. Make sure you got the path right.
Report Abuse
icelys is not online. icelys
Joined: 13 Mar 2016
Total Posts: 49
08 Jan 2017 06:47 PM
Not sure...

try game.Players:WaitForChild(name)?
Report Abuse
dudefun1234 is not online. dudefun1234
Joined: 21 Jul 2013
Total Posts: 3038
08 Jan 2017 06:48 PM
script.Parent.MouseButton1Down:connect(function(Player) local amt = script.Parent.Parent.Parent.Amt.Cash.Text local cash = Player.ActualMoney.Value cash = cash + amt end) This is assuming ############# ## a click detector.
Report Abuse
dudefun1234 is not online. dudefun1234
Joined: 21 Jul 2013
Total Posts: 3038
08 Jan 2017 06:48 PM
assuming script dot parent is a click detector.
Report Abuse
Trestin4 is not online. Trestin4
Joined: 11 Oct 2012
Total Posts: 285
08 Jan 2017 06:49 PM
Still says nil. And the name is in the same spot cash is, just a different name.
Report Abuse
dudefun1234 is not online. dudefun1234
Joined: 21 Jul 2013
Total Posts: 3038
08 Jan 2017 06:49 PM
script.Parent.MouseButton1Down:connect(function(Player)
local amt = script.Parent.Parent.Parent.Amt.Cash.Text
local cash = Player.ActualMoney.Value cash = cash + amt
end)
Report Abuse
Trestin4 is not online. Trestin4
Joined: 11 Oct 2012
Total Posts: 285
08 Jan 2017 06:51 PM
It's a Gui and it is not meant to go to the player who clicked it, it's pretty much a donate script.
Report Abuse
VisualGraphics is not online. VisualGraphics
Joined: 26 Nov 2010
Total Posts: 6515
08 Jan 2017 06:51 PM
function onClicked()
local amt = script.Parent.Parent.Parent.Amt.Cash.Text
local name = script.Parent.Parent.Parent.Amt.Name.Text
local plr = game.Players:FindFirstChild(name)
if plr ~= nil then
local cash = plr.ActualMoney.Value
cash = cash + amt
else
print('error')
end

script.Parent.MouseButton1Click:connect(onClicked)
Report Abuse
Trestin4 is not online. Trestin4
Joined: 11 Oct 2012
Total Posts: 285
08 Jan 2017 06:53 PM
Doesn't work visual
Report Abuse
dudefun1234 is not online. dudefun1234
Joined: 21 Jul 2013
Total Posts: 3038
08 Jan 2017 06:57 PM
Well if its a gui and I am assuming, a localscript. Then the player is just game.Players.LocalPlayer
Report Abuse
Trestin4 is not online. Trestin4
Joined: 11 Oct 2012
Total Posts: 285
08 Jan 2017 07:03 PM
It's not a local script, and as I said before, it is not for the local player. It's meant to give to other players.
Report Abuse
dudefun1234 is not online. dudefun1234
Joined: 21 Jul 2013
Total Posts: 3038
09 Jan 2017 02:48 AM
^ I am really not understand what context this is whatsoever.
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