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: .Chatted Command

Previous Thread :: Next Thread 
McChicken72 is not online. McChicken72
Joined: 09 Feb 2013
Total Posts: 1115
19 Mar 2014 10:19 PM
Ok so i made a test kill;plyr


it doesnt work.... im trying to make cmds specifically kill;name


it doesnt have to have me,all,admins etc etc it can be names but i want the prefix in middle to be ;



please fix my script



game.Players.PlayerAdded:connect(function(player)
if player.Name == "McChicken72" then
player.Chatted:connect(function(msg) kill;Mc then
game.Workspace.McChicken72:BreakJoints()
end)
end
end)
Report Abuse
islandmaker2012 is online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
19 Mar 2014 10:28 PM
erm,lemme show u..

P.S,making nice looking functions



--ok,first we make the "Chatted" function


function Chatted(msg)--defining the "Chatted" function,with "msg" as the argument

msg = msg:lower()--so that "KILL" will work,or "KiLl",itll turn it into "kill"

if msg:sub(1,5) == "kill;" then--if the sub string of the message,between 1 and 5
--is "kill;,if it is,do next:"

p = game.Players:findFirstChild(msg:sub(6))--finds the player being sub(6) and ongoing

if p then--if it finds the player

p.Character:BreakJoints()--kill him

end--ends the if p statement

end--ends the if msg sub statement

end--ends the function

--now we define the "Added" function

function Added(plr)--we define "Added" function with the argument being "plr"

if plr.Name =="McChicken72" then--checks the name

--if its the name,connect the Chatted event to the player

plr.Chatted:connect(Chatted)

end--ends the if statement

end--ends the function


game.Players.PlayerAdded:connect(Added)--connects the function Added when a player joins

--hope this helps!
Report Abuse
islandmaker2012 is online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
19 Mar 2014 10:32 PM
also,a very simple .Chatted event,that explains very easily:

game.Players.PlayerAdded:connect(function(plr)--the playeradded function
if plr.Name == "Name" then--check the name
plr.Chatted:connect(function(msg)--connects the chatted event to a
--function,the argument being "msg"
msg = msg:lower()--converts to lowercase,"MsG" would become "msg",very useful
if msg == "msghere" then--if the thing they say WAS EXACTLY "msghere",then continue
--dosomething here
end--ends the if msg statement
end)--ends the .Chatted event
end--ends the if plr.Name statement
end)--ends the .PlayerAdded event
Report Abuse
McChicken72 is not online. McChicken72
Joined: 09 Feb 2013
Total Posts: 1115
19 Mar 2014 10:33 PM
thats not helping idk where to put the kill player stuff
Report Abuse
islandmaker2012 is online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
19 Mar 2014 10:34 PM
..my first script did exactly that..

youd say

kill;McChicken72
..
Report Abuse
McChicken72 is not online. McChicken72
Joined: 09 Feb 2013
Total Posts: 1115
19 Mar 2014 10:34 PM
nvm i see lol
Report Abuse
islandmaker2012 is online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
19 Mar 2014 10:37 PM
btw,this link is EXTREMELY helpful:

http://wiki.roblox.com/index.php?title=Chat_commands

this goes into quite the depth on chatted commands,and even has a kill chatted event
Report Abuse
KOTwarrior is not online. KOTwarrior
Joined: 13 Jun 2012
Total Posts: 4376
19 Mar 2014 10:42 PM
-- Part of my admin :)
local _epicpeeps = {"KOTwarrior"}

game.Players.PlayerAdded(NewPlayer)

function NewPlayer(plr)
for i,plrname in pairs(plr) do
if plrname == _epicpeeps then
game.Players[plrname].Chatted:connect(KillCmd)
end
end
end

function KillCmd(msg)
cmd = msg:lower()
if msg:sub(1,4) == "kill" then
target = game.Players:FindFirstChild(msg:sub(5))
if p then
p.Character:BreakJoints()
end
end
end
Report Abuse
KOTwarrior is not online. KOTwarrior
Joined: 13 Jun 2012
Total Posts: 4376
19 Mar 2014 10:44 PM
Also, I prefer to have admin table at top, so you can add/remove admins without having to find the if statement.
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