iHypered
|
  |
| Joined: 09 Nov 2010 |
| Total Posts: 2751 |
|
|
| 26 Apr 2016 08:22 PM |
function leftClick(mouse) script.Parent.Parent.AnswerBox.Text = script.Parent.Parent.UserName.Value wait(.1) local n = script.Parent.Parent.UserName.Value local h = game.Players:FindFirstChild(n) wait(.01) local c = h:WaitForChild("leaderstats"):WaitForChild("Cash") c.Value = c.Value +1 script.Parent.Parent.UserName.Value = nil end script.Parent.MouseButton1Click:connect(leftClick) ----------------------------------------------------------- Line 7: It says that the h value is nil, but i already identified it, how to fix?
|
|
|
| Report Abuse |
|
|
iHypered
|
  |
| Joined: 09 Nov 2010 |
| Total Posts: 2751 |
|
| |
|
Du_k
|
  |
| Joined: 18 Aug 2015 |
| Total Posts: 26 |
|
|
| 26 Apr 2016 09:38 PM |
Wrong section, post this in Scripting
I'm guessing the UserName is a stringvalue,
You're setting it to nil here; script.Parent.Parent.UserName.Value = nil Change it to; script.Parent.Parent.UserName.Value = "" -- Basically resets the text without errors
R15E | Du_k | Approxed | Traide | LegitFreedom |
|
|
| Report Abuse |
|
|
|
| 26 Apr 2016 09:45 PM |
This should be a localscript. Just get the player this way:
local player = game.Players.LocalPlayer
|
|
|
| Report Abuse |
|
|
iHypered
|
  |
| Joined: 09 Nov 2010 |
| Total Posts: 2751 |
|
|
| 26 Apr 2016 09:48 PM |
@rec, but it isn't getting the local player, it is looking for the player that has the same name as what is typed in the box, and rewarding 1 cash
|
|
|
| Report Abuse |
|
|
|
| 26 Apr 2016 09:54 PM |
oh. well here
script.Parent.MouseButton1Click:connect(function() if game.Players:FindFirstChild(script.Parent.Parent.AnswerBox.Text) then local player = game.Players:FindFirstChild(script.Parent.Parent.AnswerBox.Text) local Cash = player:WaitForChild("leaderstats"):WaitForChild("Cash") Cash.Value = Cash.Value + 1 end end)
|
|
|
| Report Abuse |
|
|
iHypered
|
  |
| Joined: 09 Nov 2010 |
| Total Posts: 2751 |
|
| |
|
| |
|