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: Help with tools

Previous Thread :: Next Thread 
Leg0brick is not online. Leg0brick
Joined: 24 Jul 2012
Total Posts: 651
28 Jul 2014 08:09 PM
This script adds "Points" to the leaderboard of the player who clicked with the tool equipped. The first part of the script runs then it stops where the line of code that adds points is. Here is the line of code:

local player = game.Players:GetPlayerFromCharacter(script.Parent.Parent)


if player then
player.leaderstats:findFirstChild("Taco Bites") = player.leaderstats:findFirstChild("Taco Bites").Value + 1

end

Thanks for helping SH c:!
Report Abuse
MomoiroCloverZ is not online. MomoiroCloverZ
Joined: 06 Jan 2013
Total Posts: 825
28 Jul 2014 08:11 PM
player.leaderstats:findFirstChild("Taco Bites").Value = player.leaderstats:findFirstChild("Taco Bites").Value + 1



MomoiroCloverZ, newbag expert Lua coder.
Report Abuse
Leg0brick is not online. Leg0brick
Joined: 24 Jul 2012
Total Posts: 651
28 Jul 2014 08:17 PM
Same thing happens. But it says this in the output:
18:16:47.410 - Stack Begin
18:16:47.410 - Script 'Workspace.TehTool.Script', Line 23
18:16:47.410 - Stack End
18:16:47.411 - Disconnected event because of exception
Report Abuse
MomoiroCloverZ is not online. MomoiroCloverZ
Joined: 06 Jan 2013
Total Posts: 825
28 Jul 2014 08:19 PM
can you give us the line above what you showed me


MomoiroCloverZ, newbag expert Lua coder.
Report Abuse
Leg0brick is not online. Leg0brick
Joined: 24 Jul 2012
Total Posts: 651
28 Jul 2014 08:28 PM
Ye hang on
Report Abuse
Leg0brick is not online. Leg0brick
Joined: 24 Jul 2012
Total Posts: 651
28 Jul 2014 08:33 PM
Here it is:


local Tool = script.Parent;

enabled = true




function onActivated()
if not enabled then
return
end

enabled = false
Tool.GripForward = Vector3.new(-0.97, 1.02e-005, -0.243)
Tool.GripPos = Vector3.new(-0.2, 0, -1.23)
Tool.GripRight = Vector3.new(0.197, 0.581, -0.79)
Tool.GripUp = Vector3.new(-0.141, 0.814, 0.563)

local player = game.Players:GetPlayerFromCharacter(script.Parent.Parent)

if player then
player.leaderstats:findFirstChild("Taco Bites").Value = player.leaderstats:findFirstChild("Taco Bites").Value + 1
Report Abuse
MomoiroCloverZ is not online. MomoiroCloverZ
Joined: 06 Jan 2013
Total Posts: 825
28 Jul 2014 08:43 PM
i meant in the output window


MomoiroCloverZ, newbag expert Lua coder.
Report Abuse
Leg0brick is not online. Leg0brick
Joined: 24 Jul 2012
Total Posts: 651
28 Jul 2014 08:46 PM
18:44:01.107 - Workspace.Tool.Script:23: attempt to index a nil value
18:44:01.108 - Stack Begin
18:44:01.109 - Script 'Workspace.Tool.Script', Line 23
18:44:01.109 - Stack End
18:44:01.109 - Disconnected event because of exception
Report Abuse
MomoiroCloverZ is not online. MomoiroCloverZ
Joined: 06 Jan 2013
Total Posts: 825
28 Jul 2014 08:47 PM
so it looks as if player.leaderstats doesnt exist?


MomoiroCloverZ, newbag expert Lua coder.
Report Abuse
Leg0brick is not online. Leg0brick
Joined: 24 Jul 2012
Total Posts: 651
28 Jul 2014 08:49 PM
It dose.. Weird ..
Report Abuse
Leg0brick is not online. Leg0brick
Joined: 24 Jul 2012
Total Posts: 651
28 Jul 2014 10:51 PM
Help/Bump! I have a script to make the leaderstats
Report Abuse
Leg0brick is not online. Leg0brick
Joined: 24 Jul 2012
Total Posts: 651
28 Jul 2014 10:57 PM
bump
Report Abuse
Leg0brick is not online. Leg0brick
Joined: 24 Jul 2012
Total Posts: 651
28 Jul 2014 11:04 PM
b C'mon please?
Report Abuse
Leg0brick is not online. Leg0brick
Joined: 24 Jul 2012
Total Posts: 651
28 Jul 2014 11:10 PM
b
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
28 Jul 2014 11:14 PM
I just wanna point out you never actually said anything about when the player clicks do -whatever-

So the script just runs and tries to add points as soon as they get the tool, probably before the stats load.
Report Abuse
Leg0brick is not online. Leg0brick
Joined: 24 Jul 2012
Total Posts: 651
28 Jul 2014 11:16 PM
But it runs when clicked so...
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
28 Jul 2014 11:20 PM
No it doesn't because you didn't make a click function
Report Abuse
Leg0brick is not online. Leg0brick
Joined: 24 Jul 2012
Total Posts: 651
29 Jul 2014 04:50 PM
I'm just using a Sandwich script... Do I need to re-do the whole script? It works fine with out the part that I added:

local player = game.Players:GetPlayerFromCharacter(script.Parent.Parent)

if player then
player.leaderstats:findFirstChild("Taco Bites") = player.leaderstats:findFirstChild("Taco Bites").Value + 1

end
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
29 Jul 2014 11:55 PM
You have to add the part that checks for clicks...
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