im2awsm
|
  |
| Joined: 25 Aug 2010 |
| Total Posts: 2295 |
|
|
| 03 Nov 2014 10:46 PM |
So, in my script I'm creating a new StringValue with the name of a player. Then I need to be able to find that StringValue. This is what I have:
humanoid.Parent.DamageDone:FindFirstChild(game.Players.LocalPlayer.Name)
So, for example if 'coolguyjoe123' was in the game, it would try and find a StringValue named 'coolguyjoe123' in the 'DamageDone' model. |
|
|
| Report Abuse |
|
|
128GB
|
  |
| Joined: 17 Apr 2014 |
| Total Posts: 8056 |
|
| |
|
im2awsm
|
  |
| Joined: 25 Aug 2010 |
| Total Posts: 2295 |
|
|
| 03 Nov 2014 11:10 PM |
| How do I do what I need to do? The above code doesn't seem to work. |
|
|
| Report Abuse |
|
|
adeep
|
  |
| Joined: 06 Feb 2010 |
| Total Posts: 274 |
|
|
| 03 Nov 2014 11:12 PM |
| You can always make a StringValue and insert it into the script. Then insert players name in StringValue... |
|
|
| Report Abuse |
|
|
adeep
|
  |
| Joined: 06 Feb 2010 |
| Total Posts: 274 |
|
|
| 03 Nov 2014 11:14 PM |
| You know your looking for the "Model" in "DamageDone"? |
|
|
| Report Abuse |
|
|
|
| 03 Nov 2014 11:28 PM |
um i know how to find the character
game.Players.PlayerAdded:connect(function(player) player.Character -- after that put script there end) |
|
|
| Report Abuse |
|
|
128GB
|
  |
| Joined: 17 Apr 2014 |
| Total Posts: 8056 |
|
|
| 04 Nov 2014 12:13 AM |
Well humanoid.Parent.DamageDone:FindFirstChild(game.Players.LocalPlayer.Name)
What is humanoid, what is humanoid.Parent, does humanoid.Parent have something named 'DamageDown' and is it a local script? |
|
|
| Report Abuse |
|
|
im2awsm
|
  |
| Joined: 25 Aug 2010 |
| Total Posts: 2295 |
|
|
| 04 Nov 2014 02:30 AM |
| sorry if I wasn't clear enough. DamageDone is a model that a STRINGVALUE with a name of a player in it's value. It doesn't matter what 'humanoid' is. It's a defined thing which is under control. This script will be a local script. The script needs to find a value (the stringvalue i mentioned earlier) with the same name as the local player. this is a pain to explain .-. What I need to do is find the value which is the same name as the current player's name in the model named 'DamageDone' |
|
|
| Report Abuse |
|
|
SirNoobly
|
  |
| Joined: 01 Oct 2009 |
| Total Posts: 253 |
|
|
| 04 Nov 2014 02:35 AM |
Why not instead of a StringValue use an ObjectValue that leads to the player in Players.
I think. |
|
|
| Report Abuse |
|
|
SirNoobly
|
  |
| Joined: 01 Oct 2009 |
| Total Posts: 253 |
|
|
| 04 Nov 2014 02:39 AM |
Oh I just got it. You would iterate through all the values.
for _,v in pairs (humanoid.Parent.DamageDone:GetChildren()) do if v:IsA("StringValue") and v.Value == game.Players.LocalPlayer.Name then print("voila") end end
I think. |
|
|
| Report Abuse |
|
|
im2awsm
|
  |
| Joined: 25 Aug 2010 |
| Total Posts: 2295 |
|
|
| 04 Nov 2014 02:46 AM |
| Sorry, I'm dumb. I explained it completely wrong. So, in DamageDone, there will be a NUMBERVALUE with the NAME of the local player. In the value of the NUMBERVALUE, it will be something unrelated. So I need to search for a value with the same name as the local player. This will be in a local script. |
|
|
| Report Abuse |
|
|
im2awsm
|
  |
| Joined: 25 Aug 2010 |
| Total Posts: 2295 |
|
|
| 04 Nov 2014 02:51 AM |
| So, a way of describing what I want to do (But this doesn't work :/) DamageDone:FindFirstChild(localPlayersValue)... localPlayersValue would be the numbervalue which is named from the local player. This is so confusing .-. |
|
|
| Report Abuse |
|
|
SirNoobly
|
  |
| Joined: 01 Oct 2009 |
| Total Posts: 253 |
|
|
| 04 Nov 2014 03:01 AM |
128GB gave you it (make sure you have humanoid):
humanoid.Parent.DamageDone:FindFirstChild(game.Players.LocalPlayer.Name)
FindFirstChild would find the first child of the object the same Name as the Parameter you gave it. The number value should named after said player that did damage for it to work (I'm guessing you are not naming the number value correctly).
I think. |
|
|
| Report Abuse |
|
|
SirNoobly
|
  |
| Joined: 01 Oct 2009 |
| Total Posts: 253 |
|
|
| 04 Nov 2014 03:02 AM |
Also be sure that it's done in a Local Script.
I think. |
|
|
| Report Abuse |
|
|
128GB
|
  |
| Joined: 17 Apr 2014 |
| Total Posts: 8056 |
|
|
| 04 Nov 2014 11:27 AM |
run this in the command bar and post the output
local thing = workspace.model --your thing
function printHeritage(o, x) print(("-"):rep(x) .. o.Name .. ", " .. o.ClassName) for _, object in pairs(o:getChildren()) do printHeritage(object, x + 2) end end
function heritage(o) print(o.Name .. ", " .. o.ClassName) for _, object in pairs(o:getChildren()) do printHeritage(object, 2) end end
heritage(thing) |
|
|
| Report Abuse |
|
|