| |
|
Seranok
|
  |
| Joined: 12 Dec 2009 |
| Total Posts: 11083 |
|
|
| 27 Mar 2015 08:27 PM |
local inGame = false for _, player in pairs(game:GetService("Players"):GetPlayers()) do if player.Name == "ReverseUniverse" then inGame = true break end end
print(inGame) --> true |
|
|
| Report Abuse |
|
|
|
| 27 Mar 2015 08:27 PM |
local players = game:GetService("Players")
function findPlayer(playerName) for i,v in next, players:GetPlayers() do if v.Name == playerName then return v end end end
if findPlayer("PlayerNameHere") then print("Player is in the game!") end |
|
|
| Report Abuse |
|
|
| |
|
IoIiderp
|
  |
| Joined: 05 Feb 2012 |
| Total Posts: 8613 |
|
|
| 27 Mar 2015 08:28 PM |
if game.Players:FindFirstChild("ReverseUniverse") then -- code here end |
|
|
| Report Abuse |
|
|
amanda
|
  |
| Joined: 21 Nov 2006 |
| Total Posts: 5925 |
|
|
| 27 Mar 2015 08:29 PM |
You ask billions of silly questions. I recommend learning the basics BEFORE you post here, because it's annoying for someone to ask how to do every little thing.
You should always attempt doing something before asking for help. If you do not have a single line of code, then you do not begin to understand the concept.
We are here to help, not to teach you to script, not to write your scripts for you. |
|
|
| Report Abuse |
|
|
|
| 27 Mar 2015 08:31 PM |
>>if game.Players:FindFirstChild("ReverseUniverse") then -- code here end
But what if there is a non-player instance in the players service? |
|
|
| Report Abuse |
|
|
IoIiderp
|
  |
| Joined: 05 Feb 2012 |
| Total Posts: 8613 |
|
|
| 27 Mar 2015 08:40 PM |
@amanda There are no silly questions. If that's his level, it can be really confusing for him.
@nQ Then he works inefficiently. |
|
|
| Report Abuse |
|
|
amanda
|
  |
| Joined: 21 Nov 2006 |
| Total Posts: 5925 |
|
|
| 27 Mar 2015 08:57 PM |
@IoIiderp
I love answering questions here, but I love it for a specific reason. Not because I am a servant to this subsection, or feel obligated in any way.
It is because I love seeing users grow as scripters, learn from their mistakes.
I started coming here when I was still an uber beginner, but I understood really basic Lua syntax, and I had a basic grasp of how to learn new information.
I helped those who knew less than me then, and asked questions when I needed help, but most of my time was in Studio, I spent hours there even as a beginner trying to solve my code on my own, because it was such a feat whenever I made something that worked back then.
As a scripter, you need resources, you need somewhere to write down your code, somewhere to execute it, somewhere to debug, those 3 can be covered by ROBLOX Studio alone. To really understand any language, you need an outside influence, but you also need initiative.
He has not asked how to script, how to find more information. I've seen 10+ of his threads in the past two days, where he offered absolutely no code to work with, and blatantly asked for scripts such as here.
They haven't been overly complicated concepts, as you can see, but that makes it all the more ridiculous that he hasn't taken any sort of initiative to find out on his own any of these topics, also, I doubt he has learned the basics.
What I am getting at is I honestly don't believe he is learning. I believe he is compiling scripts to make a game, and whenever it doesn't work he will have 500 pieces of our code we wrote for him that he doesn't understand how to connect.
I am here to help others, and the only thing I can think of to help him is advice.
--
This is to the OP himself.
If you have the ability to script, but are still a beginner, you need to make sure you are actually understanding the pieces of each script, how it works, why it works, how it can be applied in a different situation.
If any of this is unclear, it is perfectly fine to ask what a chunk of clean code does here.
If you are struggling with the basics, I recommend asking for help, asking for a link to a good tutorial video or website because it is really worth the effort to learn.
I hope you take the most out of this subsection you can, not just code, but knowledge. |
|
|
| Report Abuse |
|
|
IoIiderp
|
  |
| Joined: 05 Feb 2012 |
| Total Posts: 8613 |
|
|
| 27 Mar 2015 09:06 PM |
@amanda It was no personal attack. Just saying. |
|
|
| Report Abuse |
|
|
|
| 28 Mar 2015 09:50 PM |
I'm not at a very high skill level like you so thats why i ask "silly" questions, it is just how i learn and progress threw Lua. |
|
|
| Report Abuse |
|
|
|
| 28 Mar 2015 10:07 PM |
| lol i tryed you method but i got an error saying "attempt to call a nil value" |
|
|
| Report Abuse |
|
|