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: Onchatted help?

Previous Thread :: Next Thread 
McChicken72 is not online. McChicken72
Joined: 09 Feb 2013
Total Posts: 1115
05 Jan 2014 03:47 PM
ok so i am needing onchatted help (admin commands) i am trying to make somthing like this so how would i do it



Admins = {"","","",""}

function OnChatted(msg)
if msg = "kill/" then
killPlayer.Name
end
Report Abuse
McChicken72 is not online. McChicken72
Joined: 09 Feb 2013
Total Posts: 1115
05 Jan 2014 03:47 PM
or ...




Admins = {"","","",""}
if not Admins then script.Parent:remove()
function OnChatted(msg)
if msg = "kill/" then
killPlayer.Name
end
Report Abuse
rosenburger is not online. rosenburger
Joined: 03 Aug 2009
Total Posts: 8407
05 Jan 2014 03:52 PM
Here's a simple way without anything super fancy like shortening names.

admins = {"rosenburger", "McChicken72")

game.Players.PlayerAdded:connect(function(plr)
plr.CharacterAdded:wait()
for i,v in pairs(admins) do
if v:lower() == plr.Name:lower() then
plr.Chatted:connect(function(msg)
if string.sub(msg,1,5):lower() == "/kill" then
if game.Players:FindFirstChild(string.sub(msg, 6) then
local victim = game.Players:FindFirstChild(string.sub(msg, 6)
if victim.Character:FindFirstChild("Humanoid") then
humanoid:TakeDamage(100) -- :TakeDamage() doesn't take damage if they have a forcefield
end
end
end
end)
end
end
end)
Report Abuse
rosenburger is not online. rosenburger
Joined: 03 Aug 2009
Total Posts: 8407
05 Jan 2014 03:52 PM
Whoops my above code actually has some syntax error I'll fix it one sec
Report Abuse
rosenburger is not online. rosenburger
Joined: 03 Aug 2009
Total Posts: 8407
05 Jan 2014 03:55 PM
admins = {"rosenburger", "McChicken72")

function isAdmin(plr)
for i,v in pairs(admins) do
if v:lower() == plr.Name:lower() then
return true
end
end
return false
end

game.Players.PlayerAdded:connect(function(plr)
plr.CharacterAdded:wait()
if isAdmin(plr) then
plr.Chatted:connect(function(msg)
if string.sub(msg,1,5):lower() == "/kill" then
if game.Players:FindFirstChild(msg:sub(6)) then
local victim = game.Players:FindFirstChild(msg:sub(6))
if victim.Character:FindFirstChild("Humanoid") then
local humanoid = victim.Character:FindFirstChild("Humanoid")
humanoid:TakeDamage(100) -- TakeDamage doesn't take damage if they have a force field
end
end
end
end)
end
end)
Report Abuse
McChicken72 is not online. McChicken72
Joined: 09 Feb 2013
Total Posts: 1115
05 Jan 2014 03:57 PM
um i was looking for somthing like kill:rosenburger commands
Report Abuse
rosenburger is not online. rosenburger
Joined: 03 Aug 2009
Total Posts: 8407
05 Jan 2014 04:02 PM
No
I just gave you a script, whenever you want to kill someone just do this

/kill rosenburger

You have to use the full name because I didn't script the shortening names since I try to help people quickly.

You can make it all caps or all lowercase or a mix it doesn't matter.
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