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: help me please

Previous Thread :: Next Thread 
gokario is not online. gokario
Joined: 26 Jun 2011
Total Posts: 9
18 Sep 2011 07:47 PM
how do i make commands in a place?
Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
18 Sep 2011 07:48 PM
you script it

­<'+1 Post. Ujelly?'>
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
18 Sep 2011 08:09 PM
You wanna know?Find I'll tell you

Find chuck norris, tell him to smack the chaps off your lips, go on tv and say you need an admin command script. That always works!
Report Abuse
MrGamer100 is not online. MrGamer100
Joined: 06 Jun 2008
Total Posts: 72
18 Sep 2011 08:27 PM
To make admin commands in a place, you need to use Lexical Scoping in Lua so you can use the Player instance when working with a Chatted callback. Example:


game.Players.PlayerAdded:connect( player )

player.Chatted:connect( msg, recipient )

if( player.Name == "gokario" ) then

if( string.sub( string.lower( msg ), 1, 5 ) == "kick/" ) then

local person = string.lower( string.sub( msg, 6 ) );

for i, v in ipairs( game.Players:GetPlayers( ) ) do

if( string.lower( v.Name ) == person ) then

v:remove( );

end

end

end

end

end );

end );


I don't guarantee this will work, but it SHOULD. You have to type the person's full name. You can fill in the other blanks and create your own admin commands script.
Report Abuse
gokario is not online. gokario
Joined: 26 Jun 2011
Total Posts: 9
19 Sep 2011 07:15 PM
thanks for that. :) that really helped.
Report Abuse
ShoeBox4 is not online. ShoeBox4
Joined: 06 Apr 2011
Total Posts: 890
19 Sep 2011 07:23 PM
Or do it the way that you don't have to say the full name :D

game.ChildAdded:connect(function(ply)
ply.Chatted:connect(function(msg, speaker)
if speaker.Name == "gokario" then
if string.sub(msg, 1, 5) == "kick;" then
local num = string.match(string.sub(msg, 6)
num = string.lower(num)
for _, v in pairs(game.Players:GetChildren()) do
if string.find(string.lower(v.Name), num) then
v:remove()
end
end
end
end)
end)

Now you can just say "kick;shoe" or something.

-----You mad bro?-----
Report Abuse
gokario is not online. gokario
Joined: 26 Jun 2011
Total Posts: 9
19 Sep 2011 07:29 PM
btw wats lexicle scoping? im sorry but im still new to roblox
Report Abuse
MrGamer100 is not online. MrGamer100
Joined: 06 Jun 2008
Total Posts: 72
19 Sep 2011 08:59 PM
As far as I know, Lexical Scoping is making arguments/variables that would normally be unavailable to a function/statement available by nesting another function within that root function. Like, what I did with connecting Chatted to PlayerAdded: You can now use the Player argument in your Chatted callback function, which cannot normally be done.


@Shoe, thanks for posting that. I've been wondering how that was done...
Report Abuse
ShoeBox4 is not online. ShoeBox4
Joined: 06 Apr 2011
Total Posts: 890
19 Sep 2011 09:00 PM
No problem.
Report Abuse
gokario is not online. gokario
Joined: 26 Jun 2011
Total Posts: 9
20 Sep 2011 07:00 PM
also what do u click on to make scripts in roblox studio
Report Abuse
Cachinnation is not online. Cachinnation
Joined: 21 Aug 2011
Total Posts: 1797
20 Sep 2011 07:06 PM
hi = {
["die"] = function(bye) bye.Character:BreakJoints() end
}

game.Players.PlayerAdded:connect(function(s)
s.Chatted:connect(function(m)
if m:sub(1,4) == "pwn/" then
hi.die(game.Players[m:sub(5)])
end end) end)
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