|
| 02 Oct 2016 08:10 PM |
How can I use a string value in a name. Such as example
p = game.Workspace.Ball.Goalscorer.Value if Game.players.P.Teamcolor == Bright Blue then blah blah blah end |
|
|
| Report Abuse |
|
|
| |
|
Cytheur
|
  |
| Joined: 12 Aug 2014 |
| Total Posts: 7328 |
|
|
| 02 Oct 2016 08:21 PM |
Oh what the heck.
Use :GetPlayerFromCharacter
ball.Touched:connect(function(hit) local value = ball:findFirstChild("Goalscorer") local player = value.Value local Player = game.Players:GetPlayerFromCharacter(player) if Player then -- Stuff end end
R$573,592 |
|
|
| Report Abuse |
|
|
|
| 02 Oct 2016 08:34 PM |
But how do i use that variable in a if statement like =
if game.Players.Player.TeamColor == BrickColor.new("Bright blue") |
|
|
| Report Abuse |
|
|
|
| 02 Oct 2016 08:36 PM |
if game.Players.P.TeamColor == BrickColor.new("Bright Blue") then -- Stuff end |
|
|
| Report Abuse |
|
|
| |
|
|
| 02 Oct 2016 08:39 PM |
| What even is the output of your code? |
|
|
| Report Abuse |
|
|
|
| 02 Oct 2016 08:41 PM |
| Where "--stuff" is, you're supposed to put your own code. The 'if' only checks a condition and runs stuff when it's true |
|
|
| Report Abuse |
|
|
|
| 02 Oct 2016 08:44 PM |
IK. Im asking if you can use a string value to call something
LIKE: Player = p.GoalScorer.Value VALUE If game.Players.Player.Teamcolor == Brickcolor.new("Bright Blue") |
|
|
| Report Abuse |
|
|
|
| 02 Oct 2016 08:45 PM |
Lemme rephrase.
How can i get a string value to call a player in game.players using a if statement? |
|
|
| Report Abuse |
|
|