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: Why won't this work?

Previous Thread :: Next Thread 
xXTheRobotXx is not online. xXTheRobotXx
Joined: 05 May 2012
Total Posts: 13343
03 Jan 2013 08:26 PM
game.Players.xXTheRobotXx.Chatted:connect(function(msg)
if msg == "kill/" then
local playertokill = msg:sub(6)
if game:GetPlayers(playertokill) then
playertokill.Character:BreakJoints()
end
end
end)

Just a simple little admin thing.

Error 407:["Siggy.exe not found."] Please try again in a few moments.
Report Abuse
doombringer42 is not online. doombringer42
Joined: 13 Nov 2007
Total Posts: 5445
03 Jan 2013 08:28 PM
if msg == "kill/" then

should be

if string.sub(msg) == "kill/" then

local playertokill = msg:sub(6)
if game:GetPlayers(playertokill) then
playertokill.Character:BreakJoints()

should be

local playertokill = game.Players[msg:sub(6)]
if playertokill then
playertokill.Character:BreakJoints()

¬ LuaLearners Elite/Writer
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
03 Jan 2013 08:28 PM
1) Make sure it checks that you're in the room or it will give a nil exception.
2) playertokill must be defined as a player, not a string.
3) Missing End ')'
Try this:

repeat wait() until game.Players:FindFirstChild("xXTheRobotXx")
game.Players.xXTheRobotXx.Chatted:connect(function(msg)
if msg == "kill/" then
local playertokillstr = msg:sub(6)
local playertokill = game.Players:FindFirstChild(playertokillstr)
if playertokill then
playertokill.Character:BreakJoints()
end
end)
end)
Report Abuse
marioblox1094 is not online. marioblox1094
Joined: 14 Aug 2010
Total Posts: 1839
03 Jan 2013 08:32 PM
game.Players.xXTheRobotXx.Chatted:connect(function(msg)
if string.sub(msg, 1,5) == "kill/" then
playertokill = string.sub(msg, 6, #msg)
if (game.Players:FindFirstChild(playertokill)) then
playertokill.Character:BreakJoints()
end
end
end)
Report Abuse
xXTheRobotXx is not online. xXTheRobotXx
Joined: 05 May 2012
Total Posts: 13343
03 Jan 2013 08:34 PM
None of yours worked.

:/

Error 407:["Siggy.exe not found."] Please try again in a few moments.
Report Abuse
marioblox1094 is not online. marioblox1094
Joined: 14 Aug 2010
Total Posts: 1839
03 Jan 2013 08:36 PM
function onChatted(msg,man,speaker)
if string.lower(speaker) == "xxtherobotxx" then
if string.sub(msg, 1,5) == "kill/" then
playertokill = string.sub(msg, 6, #msg)
if (game.Players:FindFirstChild(playertokill)) then
game.Players[playertokill].Character:BreakJoints()
end
end
end

function onPlayerEntered(newPlayer)
newPlayer.Chatted:connect(function(msg, recipient) onChatted(msg, recipient, newPlayer) end)
end

game.Players.ChildAdded:connect(onPlayerEntered)
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