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 » Scripting Helpers
Home Search
 

Re: Quest?

Previous Thread :: Next Thread 
Cheeso135 is not online. 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 is not online. Cheeso135
Joined: 13 Apr 2013
Total Posts: 2016
22 Aug 2014 06:43 PM
bump
Report Abuse
Cheeso135 is not online. 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 is not online. 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 is not online. Cheeso135
Joined: 13 Apr 2013
Total Posts: 2016
22 Aug 2014 07:02 PM
bump
Report Abuse
Cheeso135 is not online. Cheeso135
Joined: 13 Apr 2013
Total Posts: 2016
22 Aug 2014 07:23 PM
b3
Report Abuse
Verbero is not online. 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 is not online. 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 is not online. 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 is not online. Cheeso135
Joined: 13 Apr 2013
Total Posts: 2016
22 Aug 2014 07:59 PM
b4
Report Abuse
Cheeso135 is not online. Cheeso135
Joined: 13 Apr 2013
Total Posts: 2016
22 Aug 2014 08:05 PM
b5
Report Abuse
Cheeso135 is not online. Cheeso135
Joined: 13 Apr 2013
Total Posts: 2016
22 Aug 2014 08:21 PM
b6
Report Abuse
nicemike40 is not online. nicemike40
Joined: 19 Dec 2008
Total Posts: 1814
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 is not online. 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
nicemike40 is not online. nicemike40
Joined: 19 Dec 2008
Total Posts: 1814
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 is not online. 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 is not online. Cheeso135
Joined: 13 Apr 2013
Total Posts: 2016
22 Aug 2014 08:43 PM
Sorry I did not do a "reply"
Report Abuse
nicemike40 is not online. nicemike40
Joined: 19 Dec 2008
Total Posts: 1814
22 Aug 2014 09:13 PM
Try this:

codepad
.
org
/douSQC99
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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