generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Question

Previous Thread :: Next Thread 
iiEpixnesss is not online. iiEpixnesss
Joined: 31 Mar 2012
Total Posts: 170
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
iiEpixnesss is not online. iiEpixnesss
Joined: 31 Mar 2012
Total Posts: 170
02 Oct 2016 08:17 PM
bumporino
Report Abuse
Cytheur is not online. 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
iiEpixnesss is not online. iiEpixnesss
Joined: 31 Mar 2012
Total Posts: 170
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
CodeBreadpudding is not online. CodeBreadpudding
Joined: 24 Aug 2016
Total Posts: 1286
02 Oct 2016 08:36 PM
if game.Players.P.TeamColor == BrickColor.new("Bright Blue") then
-- Stuff
end
Report Abuse
iiEpixnesss is not online. iiEpixnesss
Joined: 31 Mar 2012
Total Posts: 170
02 Oct 2016 08:37 PM
Doesnt work
Report Abuse
CodeBreadpudding is not online. CodeBreadpudding
Joined: 24 Aug 2016
Total Posts: 1286
02 Oct 2016 08:39 PM
What even is the output of your code?
Report Abuse
phoenix53124 is not online. phoenix53124
Joined: 25 Feb 2009
Total Posts: 4889
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
iiEpixnesss is not online. iiEpixnesss
Joined: 31 Mar 2012
Total Posts: 170
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
iiEpixnesss is not online. iiEpixnesss
Joined: 31 Mar 2012
Total Posts: 170
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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image