|
| 13 Sep 2015 04:54 PM |
Ok, what's going on..
One.Touched:connect(function(plr) local leaderstats = plr.Parent:FindFirstChild("leaderstats") local Stage = leaderstats:FindFirstChild("Stage") if plr.Parent:FindFirstChild("leaderstats") and plr.Parent:FindFirstChild("Stage") then print("Found them") end end) |
|
|
| Report Abuse |
|
|
TwoRivers
|
  |
| Joined: 25 Aug 2011 |
| Total Posts: 2821 |
|
|
| 13 Sep 2015 04:56 PM |
a part of unknown type will touch the brick, that's not how you check / get the player.
-TwoRivers/Iterum/Vulnerite/ChiefDelta/Discommodate/100+ accounts |
|
|
| Report Abuse |
|
|
|
| 13 Sep 2015 04:56 PM |
plr is a part of a character
so
One.Touched:connect(function(char) local plr = game.Players:GetPlayerFromCharacter(char) local leaderstats = plr.Parent:FindFirstChild("leaderstats") local Stage = leaderstats:FindFirstChild("Stage") if plr.Parent:FindFirstChild("leaderstats") and plr.Parent:FindFirstChild("Stage") then print("Found them") end end) |
|
|
| Report Abuse |
|
|
|
| 13 Sep 2015 04:58 PM |
@Per
Attempt to index local plr (a nil value) |
|
|
| Report Abuse |
|
|
| |
|
TwoRivers
|
  |
| Joined: 25 Aug 2011 |
| Total Posts: 2821 |
|
|
| 13 Sep 2015 04:59 PM |
Perilous is wrong lol
-TwoRivers/Iterum/Vulnerite/ChiefDelta/Discommodate/100+ accounts |
|
|
| Report Abuse |
|
|
|
| 13 Sep 2015 05:00 PM |
Here's the leaderstats if I did something wrong here too.
-- Made by SurfaceLight
game.Players.PlayerAdded:connect(function(Player) local Leaderstats = Instance.new("IntValue",Player) Leaderstats.Name = "leaderstats" Leaderstats.Value = 0 local Stage = Instance.new("IntValue", Leaderstats) Stage.Name = "Stage" Stage.Value = 0 end) |
|
|
| Report Abuse |
|
|
|
| 13 Sep 2015 05:02 PM |
| Why isn't it finding the leaderstats... No matter how I define it, it's always going to error. ._. |
|
|
| Report Abuse |
|
|
|
| 13 Sep 2015 05:03 PM |
| print the name of what it touched and that'll help |
|
|
| Report Abuse |
|
|
|
| 13 Sep 2015 05:03 PM |
Use the GetPlayerFromCharacter function like this:
One.Touched:connect(function(plr) local leaderstats = game.Players:GetPlayerFromCharacter(plr.Parent):FindFirstChild("leaderstats") local Stage = leaderstats:FindFirstChild("Stage") if plr.Parent:FindFirstChild("leaderstats") and plr.Parent:FindFirstChild("Stage") then print("Found them") end
end) |
|
|
| Report Abuse |
|
|
TwoRivers
|
  |
| Joined: 25 Aug 2011 |
| Total Posts: 2821 |
|
|
| 13 Sep 2015 05:04 PM |
you're going to get a part to fire Touched. it could be a torso, an arm, a leg, a bullet, a gun, any number of things. check if hit.Parent is valid, check if GetPlayerFromCharacter(hit.Parent) is a player, and go onwards
-TwoRivers/Iterum/Vulnerite/ChiefDelta/Discommodate/100+ accounts |
|
|
| Report Abuse |
|
|
|
| 13 Sep 2015 05:05 PM |
@fish
Attempt to index a nil value.
What is going on? |
|
|
| Report Abuse |
|
|
TwoRivers
|
  |
| Joined: 25 Aug 2011 |
| Total Posts: 2821 |
|
|
| 13 Sep 2015 05:06 PM |
read what i said
-TwoRivers/Iterum/Vulnerite/ChiefDelta/Discommodate/100+ accounts |
|
|
| Report Abuse |
|
|
|
| 13 Sep 2015 05:06 PM |
| I already did, and that won't change a single thing. |
|
|
| Report Abuse |
|
|
| |
|
|
| 13 Sep 2015 05:19 PM |
Here, I will rewrite this
Give me a few minutes |
|
|
| Report Abuse |
|
|
|
| 13 Sep 2015 05:25 PM |
local One = workspace.Baseplate -- Change this to what "One" is
One.Touched:connect(function(Hit) -- Setting up an annoymous function for when "One" is touched local Player = game.Players:GetPlayerFromCharacter(Hit.Parent) -- Getting the player that touched the part if Player then -- Checking if the player exists local Leaderstats = Player:FindFirstChild("leaderstats") local Stage = Player:FindFirstChild("leaderstats"):FindFirstChild("Stage") if Leaderstats and Stage then print("Found them") else print("Didnt find them") end end end)
This should work |
|
|
| Report Abuse |
|
|
|
| 13 Sep 2015 05:27 PM |
So much is wrong. First,
leaderstats has to be lowercased for it to be valid.
Also, plr.Parent is the Players service, so I don't know what you're doing.
I think this is what you're looking for looking at original post.
One.Touched:connect(function(hit) local leaderstats = game.Players:GetPlayerFromCharacter(hit.Parent) local Stage = leaderstats:FindFirstChild("Stage") if leaderstats and leaderstats:FindFirstChild("Stage") then print("Found them") end end) |
|
|
| Report Abuse |
|
|
|
| 13 Sep 2015 05:28 PM |
| @laugh You're wrong, because 1. It worked when I joined the game in online mode, and 2. I'm trying to get the PLAYERS service so I can get into that players leaderstats and change the value. It doesn't take an idiot to figure that out. |
|
|
| Report Abuse |
|
|
|
| 13 Sep 2015 05:28 PM |
"leaderstats has to be lowercased for it to be valid.
Also, plr.Parent is the Players service, so I don't know what you're doing."
1.It is, the variable is with a capital L but if you look at it's value, you'll see it's lowercase dumbo
2. No it isnt. It is getting the CHARACTER or the person that touched it because in his case, "plr" returns the part touching and plr.Parent returns the parent of the part(the character) |
|
|
| Report Abuse |
|
|
|
| 13 Sep 2015 05:35 PM |
Wow you guys are so smart!
Thumbs up! |
|
|
| Report Abuse |
|
|
|
| 13 Sep 2015 05:36 PM |
Oh look, your guy's scripts still don't work.
*Face-Palm* |
|
|
| Report Abuse |
|
|
| |
|
ShungTzu
|
  |
| Joined: 14 Jun 2014 |
| Total Posts: 959 |
|
|
| 13 Sep 2015 05:41 PM |
omg, it's like watching a train wreck. fish and laugh gave correct answers.
@fish I'm pretty sure he was talking the OP, not your answer. |
|
|
| Report Abuse |
|
|
ShungTzu
|
  |
| Joined: 14 Jun 2014 |
| Total Posts: 959 |
|
|
| 13 Sep 2015 05:47 PM |
Wait. What was I thinking?
" local leaderstats = game.Players:GetPlayerFromCharacter(hit.Parent) "
laugh's answer is wrong to. The FAIL is contagious in here. gtg |
|
|
| Report Abuse |
|
|