|
| 24 Feb 2015 12:04 PM |
player = game.Players:FindFirstChild() local StringValue = Instance.new("StringValue", player) StringValue.Name = "Alive"
if player:FindFirstChild("Alive") then points = player.leaderstats.Points points.Value = points.Value + 250 end
--Check if player has StringValue named "Alive" if so then add onto players leaderstats points by 250
. |
|
|
| Report Abuse |
|
|
| |
|
SLY3
|
  |
| Joined: 10 Jul 2008 |
| Total Posts: 1700 |
|
|
| 24 Feb 2015 12:09 PM |
All should work, apart from
-- player = game.Players:FindFirstChild() --
Wtf? You need to provide a string for it to search for. |
|
|
| Report Abuse |
|
|
|
| 24 Feb 2015 12:12 PM |
| sly is right. I recommend :GetChildren() not :FindFirstChild() |
|
|
| Report Abuse |
|
|
|
| 24 Feb 2015 12:18 PM |
I thought this would find the string
local StringValue = Instance.new("StringValue", player) StringValue.Name = "Alive" |
|
|
| Report Abuse |
|
|
| |
|
|
| 24 Feb 2015 12:21 PM |
local StringValue = Instance.new("StringValue", player) StringValue.Name = "Alive"
Does NOT find the string, it MAKES the string... your basically giving them 250 free points... |
|
|
| Report Abuse |
|
|
SLY3
|
  |
| Joined: 10 Jul 2008 |
| Total Posts: 1700 |
|
|
| 24 Feb 2015 12:25 PM |
game.Players:FindFirstChild() wont work, because it's searching for nothing (nil)
Change it to this:
-- player = game.Players:FindFirstChild'PlayerName' -- |
|
|
| Report Abuse |
|
|
|
| 24 Feb 2015 12:25 PM |
so how would i find it?
and the script right now won't even give out points... |
|
|
| Report Abuse |
|
|
|
| 24 Feb 2015 12:29 PM |
--What current script looks like:
player = game.Players:FindFirstChild'PlayerName' local StringValue = Instance.new("StringValue", player) StringValue.Name = "Alive"
if player:FindFirstChild("Alive") then points = player.leaderstats.Points points.Value = points.Value + 250 end
--By the way this is a noraml script not local script.
--Also there is a brick that already gives the player a string value on touch.
--I just wanted this script to find the string value in the Player and if found give the Player 250 + points |
|
|
| Report Abuse |
|
|
| |
|
| |
|
Pkamara
|
  |
| Joined: 25 Apr 2013 |
| Total Posts: 95 |
|
|
| 24 Feb 2015 12:36 PM |
| What are you exactly asking and why are you naming the StringValue instance "Alive" when you can give it the value of Alive... |
|
|
| Report Abuse |
|
|
SLY3
|
  |
| Joined: 10 Jul 2008 |
| Total Posts: 1700 |
|
|
| 24 Feb 2015 12:50 PM |
Omfg
-- player = game.Players:FindFirstChild'PlayerName' --
I meant put the player's name in the string it's searching for. |
|
|
| Report Abuse |
|
|
|
| 24 Feb 2015 01:08 PM |
| Please show me how to put it in so i don't get confused :L |
|
|
| Report Abuse |
|
|
|
| 24 Feb 2015 01:09 PM |
| And i'm not searching for one certain player i'm looking for the local player... |
|
|
| Report Abuse |
|
|
| |
|
SLY3
|
  |
| Joined: 10 Jul 2008 |
| Total Posts: 1700 |
|
|
| 24 Feb 2015 01:10 PM |
Do this:
local player = game.Players.LocalPlayer |
|
|
| Report Abuse |
|
|
|
| 24 Feb 2015 01:19 PM |
Like this?
local player = game.Players.LocalPlayer local StringValue = Instance.new("StringValue", player) StringValue.Name = "Alive"
if player:FindFirstChild("Alive") then points = player.leaderstats.Points points.Value = points.Value + 250 end |
|
|
| Report Abuse |
|
|
SLY3
|
  |
| Joined: 10 Jul 2008 |
| Total Posts: 1700 |
|
|
| 24 Feb 2015 01:44 PM |
| Yeah, but why are you re-checking for "Alive"? |
|
|
| Report Abuse |
|
|
|
| 24 Feb 2015 01:51 PM |
| Scritp still does not work... |
|
|
| Report Abuse |
|
|
| |
|
|
| 24 Feb 2015 01:55 PM |
| That's because you didn't put it in a LocalScript you idiot. |
|
|
| Report Abuse |
|
|
SLY3
|
  |
| Joined: 10 Jul 2008 |
| Total Posts: 1700 |
|
|
| 24 Feb 2015 01:57 PM |
Okay, I'll do it for you, since you've tried for so long:
(local script):
-- local plr = game.Players.LocalPlayer local ls = Instance.new('IntValue',plr) ls.Name = 'leaderstats' local pts,alive = Instance.new('NumberValue',ls),Instance.new('StringValue',plr) pts.Name = 'Points'alive.Name = 'Alive' if plr:FindFirstChild'Alive'then pts.Value = pts.Value + 250;end -- |
|
|
| Report Abuse |
|
|
|
| 24 Feb 2015 02:03 PM |
| It has been in local script and it still won't work... |
|
|
| Report Abuse |
|
|