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: Making an admin script.

Previous Thread :: Next Thread 
youssef04 is not online. youssef04
Joined: 22 Jan 2011
Total Posts: 1745
27 May 2014 08:57 AM
It doesn't work, here is part of it:

game.Players.PlayerAdded:connect(function(player)
player.Chatted:connect(function(cht)
if cht:lower():sub(0,1) == ")" and cht:lower():sub(2,8) == "kill me" then
game.Players.LocalPlayer.Head:Destroy()
end
end)
end)
Report Abuse
robomax11 is not online. robomax11
Joined: 07 Jul 2011
Total Posts: 6828
27 May 2014 08:58 AM
you dont need to use :sub() just use

if cht:lower() == ")kill me" then
blah

also make sure is local script

ˢᶦᵈᵉ ᵉᶠᶠᵉᶜᵗˢ ᵐᵃʸ ᶦᶰᶜᶫᵘᵈᵉ﹕ ᶫᵃᶜᵗᵃᵗᶦᶰᵍ, ʰᵉᵃᵈ ᵉˣᵖᶫᵒᵈᶦᶰᵍ ˢʸᶰᵈʳᵒᵐᵉ, ᵃᶰᵈ ᶫᵒˢˢ ᵒᶠ ᵍᵉᶰiᵗᵃᶫˢ
Report Abuse
youssef04 is not online. youssef04
Joined: 22 Jan 2011
Total Posts: 1745
27 May 2014 08:58 AM
K.
Report Abuse
youssef04 is not online. youssef04
Joined: 22 Jan 2011
Total Posts: 1745
27 May 2014 09:02 AM
I ignored what you said about don't use sub(), I want to, it won't make a difference if I removed it, I made it a localscript in StarterGui.
Report Abuse
youssef04 is not online. youssef04
Joined: 22 Jan 2011
Total Posts: 1745
27 May 2014 09:12 AM
B1
Report Abuse
robomax11 is not online. robomax11
Joined: 07 Jul 2011
Total Posts: 6828
27 May 2014 09:13 AM
put in scriptstorage

ˢᶦᵈᵉ ᵉᶠᶠᵉᶜᵗˢ ᵐᵃʸ ᶦᶰᶜᶫᵘᵈᵉ﹕ ᶫᵃᶜᵗᵃᵗᶦᶰᵍ, ʰᵉᵃᵈ ᵉˣᵖᶫᵒᵈᶦᶰᵍ ˢʸᶰᵈʳᵒᵐᵉ, ᵃᶰᵈ ᶫᵒˢˢ ᵒᶠ ᵍᵉᶰiᵗᵃᶫˢ
Report Abuse
youssef04 is not online. youssef04
Joined: 22 Jan 2011
Total Posts: 1745
27 May 2014 09:27 AM
Local script, runs on client side
Normal script, runs on server side
Local script in ServerScriptService
WTF...
Report Abuse
robomax11 is not online. robomax11
Joined: 07 Jul 2011
Total Posts: 6828
27 May 2014 09:33 AM
import code to a script,

except player.Chatted:connect(function(cht) change to
player.Chatted:connect(function(p, cht)
so
its not localplayer.character
its p.Character

u dig

ˢᶦᵈᵉ ᵉᶠᶠᵉᶜᵗˢ ᵐᵃʸ ᶦᶰᶜᶫᵘᵈᵉ﹕ ᶫᵃᶜᵗᵃᵗᶦᶰᵍ, ʰᵉᵃᵈ ᵉˣᵖᶫᵒᵈᶦᶰᵍ ˢʸᶰᵈʳᵒᵐᵉ, ᵃᶰᵈ ᶫᵒˢˢ ᵒᶠ ᵍᵉᶰiᵗᵃᶫˢ
Report Abuse
youssef04 is not online. youssef04
Joined: 22 Jan 2011
Total Posts: 1745
27 May 2014 09:40 AM
Ok, it's a Normal Script in ServerScriptService, here is the full script:

game.Players.PlayerAdded:connect(function(player)
player.Chatted:connect(function(p,cht)
if cht:lower():sub(0,1) == ")" and cht:lower():sub(2,8) == "kill me" then
p.Head:Destroy()
end
if cht:lower():sub(1,1) == ")" and cht:lower():sub(2,9) == "kill all" then
game.Players:GetPlayers():BreakJoints()
end
if cht:lower():sub(1,1) == ")" and cht:lower():sub(2,12) == "kill random" then
a = game.Players:GetPlayers()
a[math.random(1,#a)]:BreakJoints()
end
if cht:lower():sub(1,1) == ")" and cht:lower():sub(2,6) == "ff me" then
Instance.new("ForceField", p.Character)
end
if cht:lower():sub(1,1) == ")" and cht:lower():sub(2,7) == "ff all" then
Instance.new("ForceField", game.Players:GetPlayers().Character)
end
if cht:lower():sub(1,1) == ")" and cht:lower():sub(2,9) == "ff random" then
b = game.Players:GetPlayers()
c = b[math.random(1,#b)]
Instance.new("ForceField", c.Character)
end

end)
end)
Report Abuse
VerifiedName is not online. VerifiedName
Joined: 26 Jul 2009
Total Posts: 4534
27 May 2014 09:43 AM
the inefficiency is burning my eyes. and it wont even work

"if cht:lower():sub(1,1) == ")" and cht:lower():sub(2,7) == "ff all" then
Instance.new("ForceField", game.Players:GetPlayers().Character)
end"

havent i told you about 10 times that you cant do something on a table(game.Players:GetPlayers())??

Report Abuse
youssef04 is not online. youssef04
Joined: 22 Jan 2011
Total Posts: 1745
27 May 2014 09:48 AM
@Verified, how do I get the last 2 characters of chat no matter how long they time?
Report Abuse
uyoyalt is not online. uyoyalt
Joined: 16 Apr 2013
Total Posts: 2860
27 May 2014 09:50 AM
print(("Hi all"):sub(4))

Output: all

This will print how matter long
Report Abuse
VerifiedName is not online. VerifiedName
Joined: 26 Jul 2009
Total Posts: 4534
27 May 2014 09:50 AM
string = "Hello!" --define


LastTwoCharacters = string:sub((string:len())-1, string:len()) print("Last 2 characters of '"..string.."' are '"..LastTwoCharacters.."'")


i dunno something like this.
Report Abuse
youssef04 is not online. youssef04
Joined: 22 Jan 2011
Total Posts: 1745
27 May 2014 09:52 AM
Ok.
Report Abuse
youssef04 is not online. youssef04
Joined: 22 Jan 2011
Total Posts: 1745
27 May 2014 09:54 AM
So would this get the last 2 characters of what the player has chatted?

cht:lower():sub(2)
Report Abuse
VerifiedName is not online. VerifiedName
Joined: 26 Jul 2009
Total Posts: 4534
27 May 2014 09:55 AM
no, that would print everything from the 2nd character onward.

Report Abuse
youssef04 is not online. youssef04
Joined: 22 Jan 2011
Total Posts: 1745
27 May 2014 09:56 AM
@Verified, I tested and it printed "all"
Report Abuse
VerifiedName is not online. VerifiedName
Joined: 26 Jul 2009
Total Posts: 4534
27 May 2014 09:57 AM
string = "Hello"

print((string:lower()):sub(2))

this prints "ello" on my screen.

Report Abuse
youssef04 is not online. youssef04
Joined: 22 Jan 2011
Total Posts: 1745
27 May 2014 10:00 AM
print(("Hi all"):sub(4)) -- Prints "all", so if I did:
cht:sub(2) -- Would that print the last to characters?
Report Abuse
VerifiedName is not online. VerifiedName
Joined: 26 Jul 2009
Total Posts: 4534
27 May 2014 10:01 AM
have you read anything i've posted?

Report Abuse
uyoyalt is not online. uyoyalt
Joined: 16 Apr 2013
Total Posts: 2860
27 May 2014 10:03 AM
It would print i all
Report Abuse
VerifiedName is not online. VerifiedName
Joined: 26 Jul 2009
Total Posts: 4534
27 May 2014 10:04 AM
I don't think anyone of you understand what "sub" does....

Report Abuse
youssef04 is not online. youssef04
Joined: 22 Jan 2011
Total Posts: 1745
27 May 2014 10:05 AM
Yes I have, but is there any other way than doing your way?
Report Abuse
youssef04 is not online. youssef04
Joined: 22 Jan 2011
Total Posts: 1745
27 May 2014 10:09 AM
@Verified, I think you messed up, I WANT the last 2 characters of what the player has chatted, so this:
print(("Hello"):sub(4)) -- Printed ello on your screen.
Report Abuse
VerifiedName is not online. VerifiedName
Joined: 26 Jul 2009
Total Posts: 4534
27 May 2014 10:10 AM
"string = "Hello!" --define


LastTwoCharacters = string:sub((string:len())-1, string:len()) print("Last 2 characters of '"..string.."' are '"..LastTwoCharacters.."'")"

this prints the last to characters of "string", did you completely ignore this or something.

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