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 » Scripting Helpers
Home Search
 

Re: findPerson function

Previous Thread :: Next Thread 
jimmybolt77 is not online. jimmybolt77
Joined: 06 Jul 2008
Total Posts: 292
11 Dec 2011 05:39 PM
I'm making an admin script, but I can't get the findPerson function right. I want to select people like "kill/all" or "kill/others" or "kill/(player name)".Can someone help?

Report Abuse
Merlin11188 is not online. Merlin11188
Joined: 20 Dec 2007
Total Posts: 4158
11 Dec 2011 05:58 PM
all = game.Players:GetPlayers()

game.Players.PlayerAdded:connect(function(newPlayer)
local function getOthers(Player)
local others = {}
for i, v in pairs(game.Players:GetPlayers()) do
if v.Name ~= Player.Name then
table.insert(others, v)
end
end
return others
end

local others = getOthers(newPlayer)
newPlayer.Chatted:connect(function(Message)
if Message:sub(1,5):lower() == "kill/" then
if Message:sub(6):lower() == "all" then
for i, v in pairs(all) do
if v.Character then
v.Character:BreakJoints()
end
end
elseif Message:sub(6):lower() == "others" then
for i, v in pairs(others) do
if v.Character then
v.Character:BreakJoints()
end
end
else
local player = game.Players:FindFirstChild(Message:sub(6))
if player and player.Character then
player.Character:BreakJoints()
end
end
end
end)
end)

That might work. I haven't tested it.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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