Cheeso135
|
  |
| Joined: 13 Apr 2013 |
| Total Posts: 2016 |
|
|
| 22 Aug 2014 06:39 PM |
So. Basically. I want to make a quest where when a player touches a brick and is holding a certain tool, the tool is removed and a leaderstat called honor goes up. I know where the mistake is but i don't know WHAT the mistake is. How do I fix this:
local stats = player:FindFirstChild('leaderstats')---Somewhere from here if not stats then return end local honor = stats:FindFirstChild('Honor') if not honor then return end-----to here function onTouched(hit) local pla = game.Players:findFirstChild(hit.Parent.Name) if pla ~= nil then local book = hit.Parent:findFirstChild("Book")--name of tool if book ~= nil then book:Remove() honor.Value = honor.Value+2 end end end script.Parent.Touched:connect(onTouched)
|
|
|
| Report Abuse |
|
|
Cheeso135
|
  |
| Joined: 13 Apr 2013 |
| Total Posts: 2016 |
|
| |
|
Cheeso135
|
  |
| Joined: 13 Apr 2013 |
| Total Posts: 2016 |
|
|
| 22 Aug 2014 06:47 PM |
| bump. this post is not even getting views -_- |
|
|
| Report Abuse |
|
|
Cheeso135
|
  |
| Joined: 13 Apr 2013 |
| Total Posts: 2016 |
|
|
| 22 Aug 2014 06:50 PM |
| bump. every single one of the views so far is mine. |
|
|
| Report Abuse |
|
|
Cheeso135
|
  |
| Joined: 13 Apr 2013 |
| Total Posts: 2016 |
|
| |
|
Cheeso135
|
  |
| Joined: 13 Apr 2013 |
| Total Posts: 2016 |
|
| |
|
Verbero
|
  |
| Joined: 24 Jul 2013 |
| Total Posts: 504 |
|
|
| 22 Aug 2014 07:25 PM |
| What is the error in the output and where is it? I think I know what your problem is, but give me that information and I can tell you for sure. |
|
|
| Report Abuse |
|
|
Verbero
|
  |
| Joined: 24 Jul 2013 |
| Total Posts: 504 |
|
|
| 22 Aug 2014 07:27 PM |
First off: You did not set the Local Player to the variable. (Line 2) If that doesn't work, reply again and I can help you from there. |
|
|
| Report Abuse |
|
|
Cheeso135
|
  |
| Joined: 13 Apr 2013 |
| Total Posts: 2016 |
|
|
| 22 Aug 2014 07:31 PM |
| Can you edit it and post? No output but I am eating dinner... |
|
|
| Report Abuse |
|
|
Cheeso135
|
  |
| Joined: 13 Apr 2013 |
| Total Posts: 2016 |
|
| |
|
Cheeso135
|
  |
| Joined: 13 Apr 2013 |
| Total Posts: 2016 |
|
| |
|
Cheeso135
|
  |
| Joined: 13 Apr 2013 |
| Total Posts: 2016 |
|
| |
|
|
| 22 Aug 2014 08:24 PM |
Well, first off you never said what 'player' meant in the script. Also, you're using 'return' in the global scope (not inside a function), which doesn't make sense for this scenario. There should be an error in the output. If there isn't, you're using the output wrong or the script is Disabled. |
|
|
| Report Abuse |
|
|
Cheeso135
|
  |
| Joined: 13 Apr 2013 |
| Total Posts: 2016 |
|
|
| 22 Aug 2014 08:29 PM |
Workspace.NPC.torso.Script:1: attempt to index global 'player' (a nil value)
First time that appeared. How do I fix? Where do I edit the script? |
|
|
| Report Abuse |
|
|
|
| 22 Aug 2014 08:39 PM |
So apparently you're not very adept at this. That's ok, everyone starts somewhere. Where is this script located? |
|
|
| Report Abuse |
|
|
Cheeso135
|
  |
| Joined: 13 Apr 2013 |
| Total Posts: 2016 |
|
|
| 22 Aug 2014 08:41 PM |
| Yeah I know sorry….It is in a model in a part of the model. When the tool touches the "torso" the tool is removed and points are added to a stat called honor. |
|
|
| Report Abuse |
|
|
Cheeso135
|
  |
| Joined: 13 Apr 2013 |
| Total Posts: 2016 |
|
|
| 22 Aug 2014 08:43 PM |
| Sorry I did not do a "reply" |
|
|
| Report Abuse |
|
|
|
| 22 Aug 2014 09:13 PM |
Try this:
codepad . org /douSQC99 |
|
|
| Report Abuse |
|
|