|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 19 Mar 2014 10:33 PM |
| thats not helping idk where to put the kill player stuff |
|
|
| Report Abuse |
|
|
|
| 19 Mar 2014 10:34 PM |
..my first script did exactly that..
youd say
kill;McChicken72 .. |
|
|
| Report Abuse |
|
|
| |
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|