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 |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 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
|
  |
| Joined: 24 Jul 2012 |
| Total Posts: 651 |
|
| |
|
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 |
|
|
|
| 28 Jul 2014 08:43 PM |
i meant in the output window
MomoiroCloverZ, newbag expert Lua coder. |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 28 Jul 2014 08:47 PM |
so it looks as if player.leaderstats doesnt exist?
MomoiroCloverZ, newbag expert Lua coder. |
|
|
| Report Abuse |
|
|
Leg0brick
|
  |
| Joined: 24 Jul 2012 |
| Total Posts: 651 |
|
| |
|
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
|
  |
| Joined: 24 Jul 2012 |
| Total Posts: 651 |
|
| |
|
Leg0brick
|
  |
| Joined: 24 Jul 2012 |
| Total Posts: 651 |
|
| |
|
Leg0brick
|
  |
| Joined: 24 Jul 2012 |
| Total Posts: 651 |
|
| |
|
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
|
  |
| Joined: 24 Jul 2012 |
| Total Posts: 651 |
|
|
| 28 Jul 2014 11:16 PM |
| But it runs when clicked so... |
|
|
| Report Abuse |
|
|
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
|
  |
| 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
|
  |
| 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 |
|
|