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: How would you make a script that...

Previous Thread :: Next Thread 
IceOrb is not online. IceOrb
Joined: 02 May 2010
Total Posts: 1206
22 Feb 2013 02:59 PM
When you chat the command ''!gamestart'' it sorts everyone into Red and Blue team, then kills everyone.
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
22 Feb 2013 03:03 PM
Not sure if this'll work, but:

    local keyMessage = "!gamestart"
    
    Game.Players.PlayerAdded:connect(function( Player )
      Player.Chatted:connect(function( Chat )
        if Chat:lower( ) == keyMessage then
          for i, v in pairs( Game.Players:GetPlayers( ) ) do
            if %i == 0 then
              v.TeamColor = BrickColor.new( "Bright red" )
              else
              v.TeamColor = BrickColor.new( "Bright blue" )
            end
            v.Character:BreakJoints( )
          end
        end
      end )
    end )

You'll have to add the admin specifications yourself.

¤ ¤ † K M <( •д• )> X D † ¤ ¤
Report Abuse
IceOrb is not online. IceOrb
Joined: 02 May 2010
Total Posts: 1206
22 Feb 2013 03:04 PM
Alright I'll test this, and I'm sure I can do that part, just the main function that I'm struggling with.
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
22 Feb 2013 03:05 PM
One of the lines should be:

    if i % 2 == 0 then

¤ ¤ † K M <( •д• )> X D † ¤ ¤
Report Abuse
IceOrb is not online. IceOrb
Joined: 02 May 2010
Total Posts: 1206
22 Feb 2013 03:10 PM
Is it the %i = 0 ?
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
22 Feb 2013 03:10 PM
Yes.

¤ ¤ † K M <( •д• )> X D † ¤ ¤
Report Abuse
IceOrb is not online. IceOrb
Joined: 02 May 2010
Total Posts: 1206
22 Feb 2013 03:11 PM
Would this work?

print("gamestart running")

local admins = {"iceorb"}
local keyMessage = "!gamestart"

Game.Players.PlayerAdded:connect(function( Player )
Player.Chatted:connect(function( Chat )
if Chat:lower( ) == keyMessage then
for i, v in pairs( Game.Players:GetPlayers( ) ) do
if i % 2 == 0 then
v.TeamColor = BrickColor.new( "Bright red" )
else
v.TeamColor = BrickColor.new( "Bright blue" )
end
v.Character:BreakJoints( )
end
end
end )
end )

function onPlayerEntered(newPlayer)
repeat wait() until newPlayer
newPlayer.Chatted:connect(function(msg)
for i = 1, #admins do
if newPlayer.Name:lower() == admins[i] then
onChatted(msg, newPlayer)
end
end
end)
end

game.Players.ChildAdded:connect(onPlayerEntered)
Report Abuse
cart6157 is not online. cart6157
Joined: 28 Feb 2009
Total Posts: 2194
22 Feb 2013 03:12 PM
Lol iceorb how many threads have you created questioning your script?
Report Abuse
IceOrb is not online. IceOrb
Joined: 02 May 2010
Total Posts: 1206
22 Feb 2013 03:13 PM
lololol, loads qq :c
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
22 Feb 2013 03:14 PM
No, for one, there are technically two playeradded events. And you can't call my chatted function, as it's an anonymous function.

 function onChatted( Chat, Player )
    if Chat:lower( ) == keyMessage then
      for i, v in pairs( Game.Players:GetPlayers( ) ) do
            if i % 2 == 0 then
          v.TeamColor = BrickColor.new( "Bright red" )
          else
          v.TeamColor = BrickColor.new( "Bright blue" )
        end
        v.Character:BreakJoints( )
      end
    end
  end

    function onPlayerEntered(newPlayer)
      repeat wait() until newPlayer
      newPlayer.Chatted:connect(function(msg)
        for i = 1, #admins do
          if newPlayer.Name:lower() == admins[i] then
            onChatted(msg, newPlayer)
          end
         end
      end)
    end
    Game.Players.PlayerAdded:connect(onPlayerEntered)

Something like this. . .

¤ ¤ † K M <( •д• )> X D † ¤ ¤
Report Abuse
IceOrb is not online. IceOrb
Joined: 02 May 2010
Total Posts: 1206
22 Feb 2013 03:18 PM
Yeah just realised I left your chat function.
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