qwertyhat
|
  |
| Joined: 06 Aug 2009 |
| Total Posts: 116 |
|
|
| 26 Jul 2013 01:09 PM |
I need to find the actual player and change a value in the player's leaderstats, I don't know how you do that. Now, I know this script won't work, it's just an example, but I need to know how to do this.
function onTouched(hit) hit.leaderstats.points.Value = 1 end script.Parent.Touched:connect(onTouched) |
|
|
| Report Abuse |
|
|
|
| 26 Jul 2013 01:12 PM |
script.Parent.Touched:connect(function(t) if script.Parent.Touched:findFirstChild("Humanoid") then Plyr = script.Parent.Touched.Name Player = game.Players:findFirstChild(Plyr) Player.leaderstats.points.Value = Player.leaderstats.points.Value end end) |
|
|
| Report Abuse |
|
|
|
| 26 Jul 2013 01:12 PM |
| Player.leaderstats.points.Value = Player.leaderstats.points.Value +1 |
|
|
| Report Abuse |
|
|
|
| 26 Jul 2013 01:13 PM |
if you have the character, it's easy to get the player
local plyr = game.Players[char.Name] |
|
|
| Report Abuse |
|
|
baheeg
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 72846 |
|
| |
|
blocco
|
  |
| Joined: 14 Aug 2008 |
| Total Posts: 29474 |
|
|
| 26 Jul 2013 01:26 PM |
@Roy: game.Players:GetPlayerFromCharacter(character)
USE THE DAMN API |
|
|
| Report Abuse |
|
|
baheeg
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 72846 |
|
| |
|
|
| 26 Jul 2013 01:27 PM |
| it's to hard to remember the names :3 |
|
|
| Report Abuse |
|
|
qwertyhat
|
  |
| Joined: 06 Aug 2009 |
| Total Posts: 116 |
|
| |
|
Hibobb
|
  |
| Joined: 18 Apr 2010 |
| Total Posts: 2146 |
|
|
| 26 Jul 2013 01:53 PM |
| Isn't :GetPlayerFromCharacter also something you could use? |
|
|
| Report Abuse |
|
|
|
| 26 Jul 2013 01:54 PM |
| nope because my way is superior and that should never ever be used again |
|
|
| Report Abuse |
|
|
Hibobb
|
  |
| Joined: 18 Apr 2010 |
| Total Posts: 2146 |
|
| |
|
blocco
|
  |
| Joined: 14 Aug 2008 |
| Total Posts: 29474 |
|
|
| 26 Jul 2013 01:59 PM |
He's lying
use the damn api |
|
|
| Report Abuse |
|
|
Hibobb
|
  |
| Joined: 18 Apr 2010 |
| Total Posts: 2146 |
|
| |
|
tdog158
|
  |
| Joined: 08 Jul 2008 |
| Total Posts: 5413 |
|
|
| 26 Jul 2013 02:00 PM |
| just use :GetPlayerFromCharacter( character ) |
|
|
| Report Abuse |
|
|
stroudie
|
  |
| Joined: 28 Nov 2008 |
| Total Posts: 2556 |
|
|
| 26 Jul 2013 02:04 PM |
GetPlayerFromCharacter takes up about as much space, or more, and will only be a superior choice in a few cases.
I think i'll stick with game.Players:FindFirstChild(char.Name) for now. |
|
|
| Report Abuse |
|
|
tdog158
|
  |
| Joined: 08 Jul 2008 |
| Total Posts: 5413 |
|
|
| 26 Jul 2013 02:09 PM |
| Alright lol. Not the best habit, but it's your code. |
|
|
| Report Abuse |
|
|