|
| 17 Nov 2012 09:39 PM |
I found out how to use string.lower
But...
How can I use it with the first part of this "if" (The findFirstChild)
if game.Players:findFirstChild(script.Parent.Parent.Box1.Text) ~= nil or (string.lower(script.Parent.Parent.Box1.Text)) == "me" or (string.lower(script.Parent.Parent.Box1.Text)) == "all" and (string.lower(script.Parent.Parent.CommandBar.Text)) == "kill"then
Its to check if a player is in the game |
|
|
| Report Abuse |
|
|
Raphael7
|
  |
| Joined: 03 Dec 2008 |
| Total Posts: 2479 |
|
|
| 17 Nov 2012 09:51 PM |
if game.Players:findFirstChild(string.lower(script.Parent.Parent.Box1.Text))~=nil then print("YOU ARE A PIRATE") end |
|
|
| Report Abuse |
|
|
Raphael7
|
  |
| Joined: 03 Dec 2008 |
| Total Posts: 2479 |
|
|
| 17 Nov 2012 09:51 PM |
| When you mention a string.lower, whatever you're going to turn into lower cases, put it inside the parenthisis. |
|
|
| Report Abuse |
|
|
|
| 17 Nov 2012 09:53 PM |
@Rap The thing about that is
if someones whole username wasnt in string.lower with that
It wouldnt find it...
What Im trying to do is make the text box not case sensitive. |
|
|
| Report Abuse |
|
|
Raphael7
|
  |
| Joined: 03 Dec 2008 |
| Total Posts: 2479 |
|
| |
|
Raphael7
|
  |
| Joined: 03 Dec 2008 |
| Total Posts: 2479 |
|
|
| 17 Nov 2012 09:56 PM |
| I did turn it into a lower case. Just try it out and tell me what you exactly want to show. |
|
|
| Report Abuse |
|
|
|
| 17 Nov 2012 09:57 PM |
| I want it to find [script.Parent.Parent.Box1.Text] in the game.Players but I want it to not be case sensitive. |
|
|
| Report Abuse |
|
|
Raphael7
|
  |
| Joined: 03 Dec 2008 |
| Total Posts: 2479 |
|
|
| 17 Nov 2012 09:58 PM |
| You want it both lower cased? |
|
|
| Report Abuse |
|
|
|
| 17 Nov 2012 10:00 PM |
| If the players name "Player1" I want it to find it even if script.Parent.Parent.Box1.Text is "PlAyEr1" or "PLAYer1" or anything |
|
|
| Report Abuse |
|
|
1Topcop
|
  |
| Joined: 09 Jun 2009 |
| Total Posts: 6635 |
|
|
| 17 Nov 2012 10:02 PM |
for n,player in pairs(game.Players:GetPlayers())do if(string.lower(player.Name)==string.lower(script.Parent.Box1.Text))then -- Stuff end end |
|
|
| Report Abuse |
|
|
Raphael7
|
  |
| Joined: 03 Dec 2008 |
| Total Posts: 2479 |
|
|
| 17 Nov 2012 10:02 PM |
^ Yeah that.
Roblox wouldn't let me post. It said it had a swear or something offending. |
|
|
| Report Abuse |
|
|
|
| 17 Nov 2012 10:06 PM |
@1Topcop That broke my script...
This is the rest of it
--Kill command start
if game.Players:findFirstChild(script.Parent.Parent.Box1.Text) ~= nil or (string.lower(script.Parent.Parent.Box1.Text)) == "me" or (string.lower(script.Parent.Parent.Box1.Text)) == "all" and (string.lower(script.Parent.Parent.CommandBar.Text)) == "kill"then
if KillLock == true then
GuiMessage.new("This command is locked")
else
if (string.lower(script.Parent.Parent.Box1.Text)) == "all" then
for Count = 1, #game.Players:GetPlayers() do
game.Players:GetPlayers()[Count].Character:breakJoints()
end
elseif (string.lower(script.Parent.Parent.Box1.Text)) == "me" then
if game.Players[script.Parent.Parent.Parent.Parent.Name].Character.Humanoid.Health == 0 then
GuiMessage.new("You are already dead")
game.Players[script.Parent.Parent.Parent.Parent.Name].Character:breakJoints()
else
game.Players[script.Parent.Parent.Parent.Parent.Name].Character:breakJoints()
end
elseif game.Players:findFirstChild(script.Parent.Parent.Box1.Text) and game.Players[script.Parent.Parent.Box1.Text].Character.Humanoid.Health == 0 then
GuiMessage.new(""..script.Parent.Parent.Box1.Text.." is already dead")
game.Players[script.Parent.Parent.Box1.Text].Character:breakJoints()
elseif game.Players:findFirstChild(script.Parent.Parent.Box1.Text) then
game.Players[script.Parent.Parent.Box1.Text].Character:breakJoints()
end end
--Kill command end |
|
|
| Report Abuse |
|
|
|
| 17 Nov 2012 10:09 PM |
Modify this codee
function getPlayer ( name , character , object ) -- Find by name , find by character , or find by an object if name then -- return game.Players:FindFirstChild ( name ) for i , v in pairs ( game.Players:GetPlayers ( ) ) do -- Gives you a chance to add name shortner if v.Name:lower () == name:lower ( ) return v end end elseif character then return game.Players:GetPlayerFromCharacter ( character ) else return game.Players:GetPlayerFromCharacter ( object.Parent ) end end
function kill ( character ) getPlayer ( something.something.Text ).Character:BreakJoints ( ) end
Chop Code. CC |
|
|
| Report Abuse |
|
|
|
| 17 Nov 2012 10:12 PM |
@Chop Disconnected event because of exception |
|
|
| Report Abuse |
|
|
|
| 17 Nov 2012 10:14 PM |
function getPlayer ( name , character , object ) -- Find by name , find by character , or find by an object if name then -- return game.Players:FindFirstChild ( name ) for i , v in pairs ( game.Players:GetPlayers ( ) ) do -- Gives you a chance to add name shortner if v.Name:lower () == name:lower ( ) return v end end elseif character then return game.Players:GetPlayerFromCharacter ( character ) else return game.Players:GetPlayerFromCharacter ( object.Parent ) end end
function kill ( character ) character:BreakJoints ( ) end
kill ( getPlayer ( something.something.Text ).Character )
Do that
Chop Code. CC |
|
|
| Report Abuse |
|
|
crouton04
|
  |
| Joined: 07 Jul 2010 |
| Total Posts: 4459 |
|
|
| 17 Nov 2012 10:21 PM |
| LOL what your trying to do is in exproexploits gui... They find the players and it's pickable.. Except I think your trying to make gui commands.. |
|
|
| Report Abuse |
|
|
|
| 17 Nov 2012 10:22 PM |
| Players.Player1.PlayerGui.AdminGui.Enter.CommandScript:115: 'then' expected near 'return' |
|
|
| Report Abuse |
|
|
|
| 17 Nov 2012 10:24 PM |
@Cro Im not trying to hack.
Im making a admin GUI |
|
|
| Report Abuse |
|
|
crouton04
|
  |
| Joined: 07 Jul 2010 |
| Total Posts: 4459 |
|
|
| 17 Nov 2012 10:31 PM |
| I didn't mean hacking, I meant that what your trying to do is in 'their' exploitgui.. |
|
|
| Report Abuse |
|
|
|
| 17 Nov 2012 10:34 PM |
| If you have the code from it, Could you post the part I need? |
|
|
| Report Abuse |
|
|
| |
|
nrscsy
|
  |
| Joined: 09 Nov 2012 |
| Total Posts: 465 |
|
|
| 17 Nov 2012 11:12 PM |
http://lua-users .org/wiki/ StringLibraryTutorial
That link is perfect for string documentation. Some of it can't be done in Roblox Lua, but it will satisfy your needs. |
|
|
| Report Abuse |
|
|