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: Command works but doesn't work

Previous Thread :: Next Thread 
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
24 Nov 2011 11:51 PM
game.Players.PlayerAdded:connect(function(p)
if p.Name == "miz656" then
p.Chatted:connect(function(chat)
local chat2 = chat:lower()
if chat2 == "kill/"..p.Name then
p.Character:BreakJoints()
end
end)
end
end)

It works but only kills me when I say kill/miz656(My name)
Report Abuse
YodaimeKing is not online. YodaimeKing
Joined: 01 Nov 2009
Total Posts: 3961
24 Nov 2011 11:54 PM
Its supposed to. Because.. well your saying your name...

If thats not what you ment did you mean the script is ment to kill everyone?
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
24 Nov 2011 11:56 PM
No lol Bad explanation

I mean it only works when I say kill/miz656

It doesn't work if I say another persons name.
Report Abuse
YodaimeKing is not online. YodaimeKing
Joined: 01 Nov 2009
Total Posts: 3961
25 Nov 2011 12:01 AM
Oh,

game.Players.PlayerAdded:connect(function(p)
if p.Name == "miz656" then -- Here is your problem
p.Chatted:connect(function(chat)
local chat2 = chat:lower()
if chat2 == "kill/"..p.Name then
p.Character:BreakJoints()
end
end)
end
end)

You have to fix it so that its not if p.Name is Miz656 aswell. Because using

if p.Name == "miz656" then

so baisically p.Name is always going to be you...

Get what i mean?

Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
25 Nov 2011 12:03 AM
That's what I was thinking too. But if I remove that then the chatted event will work for everyone.
Report Abuse
grimm343 is not online. grimm343
Joined: 18 Sep 2008
Total Posts: 2796
25 Nov 2011 12:03 AM
Well, I would say the problem is his chat2 if statement.

game.Players.PlayerAdded:connect(function(p)
if p.Name == "miz656" then
p.Chatted:Connect(function(chat)
local chat2 = chat:lower()
if string.sub(chat2,1,5) == "kill/" then
local t = string.sub(chat,6)
for _,v in pairs(game.Players:children()) do
if v.Name:match(t) then
pcall(function() v.Character:BreakJoints() end)
end
end
end
end)
end
end)
Report Abuse
grimm343 is not online. grimm343
Joined: 18 Sep 2008
Total Posts: 2796
25 Nov 2011 12:06 AM
Then again, I never used the method ':match()', and I can not find documentation of it.

If need be, use :find().

game.Players.PlayerAdded:connect(function(p)
if p.Name == "miz656" then
p.Chatted:Connect(function(chat)
local chat2 = chat:lower()
if string.sub(chat2,1,5) == "kill/" then
local t = string.sub(chat,6)
for _,v in pairs(game.Players:children()) do
if v.Name:find(t) then
pcall(function() v.Character:BreakJoints() end)
end
end
end
end)
end
end)
Report Abuse
YodaimeKing is not online. YodaimeKing
Joined: 01 Nov 2009
Total Posts: 3961
25 Nov 2011 12:06 AM
Yah his version is going to undoubtedly work.. :3
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
25 Nov 2011 12:07 AM
^

I don't like that script for some reason -_-
Report Abuse
YodaimeKing is not online. YodaimeKing
Joined: 01 Nov 2009
Total Posts: 3961
25 Nov 2011 12:09 AM
He's one of the better scripters on the forum.. So alot of the time. His help is what you might say "High Tech"
Report Abuse
grimm343 is not online. grimm343
Joined: 18 Sep 2008
Total Posts: 2796
25 Nov 2011 12:10 AM
Wait.. Yes, I have. :o

string.lower() --> :lower()
string.sub() --> :sub()
string.find() --> :find()
string.match() --> :match()
string.gmatch() -- :gmatch()

and so on.
Report Abuse
grimm343 is not online. grimm343
Joined: 18 Sep 2008
Total Posts: 2796
25 Nov 2011 12:11 AM
You dun liek my edited version of your script? D:
Report Abuse
YodaimeKing is not online. YodaimeKing
Joined: 01 Nov 2009
Total Posts: 3961
25 Nov 2011 12:15 AM
Miz i havent a clue. Me i like it... But i understand maby 40% of it :D
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
25 Nov 2011 12:17 AM
Grimm

It's to efficient, I don't like 100% efficiency...

I think I got mine to work....I need a tester :P I used GetFullName method.
Report Abuse
grimm343 is not online. grimm343
Joined: 18 Sep 2008
Total Posts: 2796
25 Nov 2011 12:23 AM
Workspace.grimm343.Torso.Fire:GetFullName()
returns
"Workspace.grimm343.Torso.Fire". :o

It is not perfect..

game.Players.PlayerAdded:connect(function(p)
if p.Name == "miz656" then
p.Chatted:Connect(function(chat)
local chat2 = chat:lower()
if string.sub(chat2,1,5) == "kill/" then
local t = string.sub(chat2,6)
for _,v in pairs(game.Players:children()) do
if v.Name:lower():find(t) then
pcall(function() v.Character:BreakJoints() end)
end
end
end
end)
end
end)

or

game.Players.PlayerAdded:connect(function(p)
if p.Name == "miz656" then
p.Chatted:Connect(function(chat)
local chat2 = chat:lower()
if string.sub(chat2,1,5) == "kill/" then
local t = string.sub(chat2,6)
for _,v in pairs(game.Players:children()) do
if v.Name:lower():match(t) then
pcall(function() v.Character:BreakJoints() end)
end
end
end
end)
end
end)
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
25 Nov 2011 12:25 AM
I used GetFullName to check if it's me chatting...
Report Abuse
grimm343 is not online. grimm343
Joined: 18 Sep 2008
Total Posts: 2796
25 Nov 2011 12:36 AM
Well, that would probably be an issue. :P
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
25 Nov 2011 12:44 AM
-_-

How?
Report Abuse
grimm343 is not online. grimm343
Joined: 18 Sep 2008
Total Posts: 2796
25 Nov 2011 12:57 AM
Explained in our PM conversation..
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
25 Nov 2011 01:07 AM
Well I PM you again about 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