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 » Game Design
Home Search
 

Re: Please help with my script

Previous Thread :: Next Thread 
TheBestAccountEver is not online. TheBestAccountEver
Joined: 21 Aug 2013
Total Posts: 139
17 Dec 2014 05:40 PM
Guys, I am working on a game that changes maps, and I created a script that picks and loads a map, but I don't know how to make it so when player is left, the map unloads and a new map is chosen because when me and my friends play it, when 1 person wins i still have to wait for the game to reach max time.




Please reply,


~~~~~TheBestAccountEver~~~~~
Report Abuse
maxomega3 is not online. maxomega3
Joined: 11 Jun 2010
Total Posts: 10668
17 Dec 2014 05:41 PM
What is the difference between people playing and people not playing?
Are they on different teams?
Report Abuse
TheBestAccountEver is not online. TheBestAccountEver
Joined: 21 Aug 2013
Total Posts: 139
17 Dec 2014 05:43 PM
No, its a free for all.
Report Abuse
maxomega3 is not online. maxomega3
Joined: 11 Jun 2010
Total Posts: 10668
17 Dec 2014 05:44 PM
But like are all the dead people on one team and everyone still fighting on another?
Report Abuse
TheBestAccountEver is not online. TheBestAccountEver
Joined: 21 Aug 2013
Total Posts: 139
17 Dec 2014 05:45 PM
no, but I'll make a team for those, just I need some scripting help.
Report Abuse
maxomega3 is not online. maxomega3
Joined: 11 Jun 2010
Total Posts: 10668
17 Dec 2014 05:55 PM
So unless you have any way to differentiate people who are still fighting and people who are dead, I can't really tell you a way other than detecting who has a sword.

Teams would make it much easier:
function GetNumberOfFighters ()
local fighters = 0
for i,v in pairs (game.Players:GetPlayers ()) do
if v.TeamColor.Name == "Really red" then
fighters = fighters + 1
end
end
return fighters
end

if GetNumberOfFighters () == 1 then
-- end the game
end
Report Abuse
TheBestAccountEver is not online. TheBestAccountEver
Joined: 21 Aug 2013
Total Posts: 139
17 Dec 2014 06:00 PM
OK, I'll work with that.


Thanks!





~TheBestAccountEver~
Report Abuse
TheBestAccountEver is not online. TheBestAccountEver
Joined: 21 Aug 2013
Total Posts: 139
17 Dec 2014 06:03 PM
Wait.
Report Abuse
TheBestAccountEver is not online. TheBestAccountEver
Joined: 21 Aug 2013
Total Posts: 139
17 Dec 2014 06:05 PM
How do I do that with my map changing script I made?

m = Instance.new("Message")
m.Parent = game.Workspace
m.Text = "The round will begin in 10 seconds"
while true do
wait(10)
local players = game.Players:GetChildren()
local num = math.random(1,3)
if num == 1 then
m.Parent = game.Workspace
m.Text = "Choosing Map..."
wait(4)
m.Text = "Map Number " ..num.. " Was Chosen"
wait(3)
m.Text = "BattleGrounds; Maker: TheBestAccountEver"
wait(3)
m.Text = "This game lasts for 2 minutes."
m.Parent = nil
game.Lighting.Map1BattleGrounds:clone().Parent = game.Workspace
players[i].Character:MoveTo(Vector3.new(-232, -18.5, -236))
game.Lighting.Knife:clone().Parent = players[i].Backpack
wait(120)
m.Parent = game.Workspace
m.Text = "Round over! Thank you for playing!"
wait(3)
m.Text = "You have 10 seconds until the start of the next game."
wait(3)
m.Parent = nil
end
if num == 2 then
m.Parent = game.Workspace
m.Text = "Choosing Map..."
wait(4)
m.Text = "Map Number " ..num.. " Was Chosen"
wait(3)
m.Text = "CrossRoads; Maker: ROBLOX"
wait(3)
m.Text = "This round lasts for 2 minutes."
wait(3)
m.Parent = nil
game.Lighting.Map2CrossRoads:clone().Parent = game.Workspace
for i = 1, # players do
players[i].Character:MoveTo(Vector3.new(-227, 136.3, -128))
game.Lighting.Knife:clone().Parent = players[i].Backpack
wait(120)
game.Workspace.Map2CrossRoads:Remove()
m.Text = "Game over! Thank you for playing!"
wait(3)
m.Text = "You have 10 seconds until the start of the next round."
wait(3)
m.Parent = nil
end
if num == 3 then
m.Parent = game.Workspace
m.Text = "Choosing Map..."
wait(4)
m.Text = "Map Number " ..num.. " Was Chosen"
wait(3)
m.Text = "How about red? No, black, no, How about both?; Maker: TheBestAcountEver"
wait(7)
m.Text = "This round lasts for 2 minutes."
wait(3)
m.Parent = nil
game.Lighting.Map3:clone().Parent = game.Workspace
for i = 1, # players do
players[i].Character:MoveTo(Vector3.new(-49, 128, 272))
game.Lighting.Knife:clone().Parent = players[i].Backpack
wait(120)
game.Workspace.Map3:Remove()
m.Parent = game.Workspace
m.Text = "Round Over! Thank you for playing!"
wait(3)
m.Text = "You have 10 seconds until the start of the next round."
wait(3)
m.Parent = nil
end
end
Report Abuse
maxomega3 is not online. maxomega3
Joined: 11 Jun 2010
Total Posts: 10668
17 Dec 2014 06:10 PM
game.Lighting.Knife:clone().Parent = players[i].Backpack
wait(120)
game.Workspace.Map2CrossRoads:Remove()

first of all, eww don't use :Remove () (:Destroy () is better)
second of all, here's how

game.Lighting.Knife:clone().Parent = players[i].Backpack
for i = 1,120 do
if GetPlayersLeft () == 1 then
break -- stops the loop
end
game.Workspace.Map2CrossRoads:Destroy()
Report Abuse
TheBestAccountEver is not online. TheBestAccountEver
Joined: 21 Aug 2013
Total Posts: 139
17 Dec 2014 06:13 PM
Thanks!
See how that works
Report Abuse
TheBestAccountEver is not online. TheBestAccountEver
Joined: 21 Aug 2013
Total Posts: 139
17 Dec 2014 06:16 PM
Ok So like this?:


m = Instance.new("Message")
m.Parent = game.Workspace
m.Text = "The round will begin in 10 seconds"
while true do
wait(10)
local players = game.Players:GetChildren()
local num = math.random(1,3)
if num == 1 then
m.Parent = game.Workspace
m.Text = "Choosing Map..."
wait(4)
m.Text = "Map Number " ..num.. " Was Chosen"
wait(3)
m.Text = "BattleGrounds; Maker: TheBestAccountEver"
wait(3)
m.Text = "This game lasts for 2 minutes."
m.Parent = nil
game.Lighting.Map1BattleGrounds:clone().Parent = game.Workspace
players[i].Character:MoveTo(Vector3.new(-232, -18.5, -236))
game.Lighting.Knife:clone().Parent = players[i].Backpack
for i = 1,120 do
if GetPlayersLeft () == 1 then
break -- stops the loop
end
m.Parent = game.Workspace
m.Text = "Round over! Thank you for playing!"
wait(3)
m.Text = "You have 10 seconds until the start of the next game."
wait(3)
m.Parent = nil
end
if num == 2 then
m.Parent = game.Workspace
m.Text = "Choosing Map..."
wait(4)
m.Text = "Map Number " ..num.. " Was Chosen"
wait(3)
m.Text = "CrossRoads; Maker: ROBLOX"
wait(3)
m.Text = "This round lasts for 2 minutes."
wait(3)
m.Parent = nil
game.Lighting.Map2CrossRoads:clone().Parent = game.Workspace
for i = 1, # players do
players[i].Character:MoveTo(Vector3.new(-227, 136.3, -128))
game.Lighting.Knife:clone().Parent = players[i].Backpack
for i = 1,120 do
if GetPlayersLeft () == 1 then
break -- stops the loop
end
game.Workspace.Map2CrossRoads:Remove()
m.Text = "Game over! Thank you for playing!"
wait(3)
m.Text = "You have 10 seconds until the start of the next round."
wait(3)
m.Parent = nil
end
if num == 3 then
m.Parent = game.Workspace
m.Text = "Choosing Map..."
wait(4)
m.Text = "Map Number " ..num.. " Was Chosen"
wait(3)
m.Text = "How about red? No, black, no, How about both?; Maker: TheBestAcountEver"
wait(7)
m.Text = "This round lasts for 2 minutes."
wait(3)
m.Parent = nil
game.Lighting.Map3:clone().Parent = game.Workspace
for i = 1, # players do
players[i].Character:MoveTo(Vector3.new(-49, 128, 272))
game.Lighting.Knife:clone().Parent = players[i].Backpack
for i = 1,120 do
if GetPlayersLeft () == 1 then
break -- stops the loop
end
game.Workspace.Map3:Remove()
m.Parent = game.Workspace
m.Text = "Round Over! Thank you for playing!"
wait(3)
m.Text = "You have 10 seconds until the start of the next round."
wait(3)
m.Parent = nil
end
end
Report Abuse
maxomega3 is not online. maxomega3
Joined: 11 Jun 2010
Total Posts: 10668
17 Dec 2014 06:43 PM
Yes, but you need to actually include the function at the top
Report Abuse
TheBestAccountEver is not online. TheBestAccountEver
Joined: 21 Aug 2013
Total Posts: 139
17 Dec 2014 06:43 PM
what fuction?
Report Abuse
maxomega3 is not online. maxomega3
Joined: 11 Jun 2010
Total Posts: 10668
17 Dec 2014 06:45 PM
function GetPlayersLeft ()
local fighters = 0
for i,v in pairs (game.Players:GetPlayers ()) do
if v.TeamColor.Name == "Really red" then
fighters = fighters + 1
end
end
return fighters
end

Report Abuse
TheBestAccountEver is not online. TheBestAccountEver
Joined: 21 Aug 2013
Total Posts: 139
17 Dec 2014 06:47 PM
m = Instance.new("Message")
m.Parent = game.Workspace
m.Text = "The round will begin in 10 seconds"
while true do
function GetNumberOfFighters () local fighters = 0 for i,v in pairs (game.Players:GetPlayers ()) do if v.TeamColor.Name == "Really red" then fighters = fighters + 1 end end return fighters end
wait(10)
local players = game.Players:GetChildren()
local num = math.random(1,3)
if num == 1 then
m.Parent = game.Workspace
m.Text = "Choosing Map..."
wait(4)
m.Text = "Map Number " ..num.. " Was Chosen"
wait(3)
m.Text = "BattleGrounds; Maker: TheBestAccountEver"
wait(3)
m.Text = "This game lasts for 2 minutes."
m.Parent = nil
game.Lighting.Map1BattleGrounds:clone().Parent = game.Workspace
players[i].Character:MoveTo(Vector3.new(-232, -18.5, -236))
game.Lighting.Knife:clone().Parent = players[i].Backpack
for i = 1,120 do
if GetPlayersLeft () == 1 then
break -- stops the loop
end
m.Parent = game.Workspace
m.Text = "Round over! Thank you for playing!"
wait(3)
m.Text = "You have 10 seconds until the start of the next game."
wait(3)
m.Parent = nil
end
if num == 2 then
m.Parent = game.Workspace
m.Text = "Choosing Map..."
wait(4)
m.Text = "Map Number " ..num.. " Was Chosen"
wait(3)
m.Text = "CrossRoads; Maker: ROBLOX"
wait(3)
m.Text = "This round lasts for 2 minutes."
wait(3)
m.Parent = nil
game.Lighting.Map2CrossRoads:clone().Parent = game.Workspace
for i = 1, # players do
players[i].Character:MoveTo(Vector3.new(-227, 136.3, -128))
game.Lighting.Knife:clone().Parent = players[i].Backpack
for i = 1,120 do
if GetPlayersLeft () == 1 then
break -- stops the loop
end
game.Workspace.Map2CrossRoads:Remove()
m.Text = "Game over! Thank you for playing!"
wait(3)
m.Text = "You have 10 seconds until the start of the next round."
wait(3)
m.Parent = nil
end
if num == 3 then
m.Parent = game.Workspace
m.Text = "Choosing Map..."
wait(4)
m.Text = "Map Number " ..num.. " Was Chosen"
wait(3)
m.Text = "How about red? No, black, no, How about both?; Maker: TheBestAcountEver"
wait(7)
m.Text = "This round lasts for 2 minutes."
wait(3)
m.Parent = nil
game.Lighting.Map3:clone().Parent = game.Workspace
for i = 1, # players do
players[i].Character:MoveTo(Vector3.new(-49, 128, 272))
game.Lighting.Knife:clone().Parent = players[i].Backpack
for i = 1,120 do
if GetPlayersLeft () == 1 then
break -- stops the loop
end
game.Workspace.Map3:Remove()
m.Parent = game.Workspace
m.Text = "Round Over! Thank you for playing!"
wait(3)
m.Text = "You have 10 seconds until the start of the next round."
wait(3)
m.Parent = nil
end
end
Report Abuse
TheBestAccountEver is not online. TheBestAccountEver
Joined: 21 Aug 2013
Total Posts: 139
17 Dec 2014 06:49 PM
do I still create teams?
Report Abuse
maxomega3 is not online. maxomega3
Joined: 11 Jun 2010
Total Posts: 10668
17 Dec 2014 06:50 PM
Take the function out of the loop. You don't need to redefine it every time.
Here's how functions work: http://www.roblox.com/Forum/ShowPost.aspx?PostID=142039136
Report Abuse
TheBestAccountEver is not online. TheBestAccountEver
Joined: 21 Aug 2013
Total Posts: 139
17 Dec 2014 06:51 PM
k
but do I create teams and if so what do I call them?
Report Abuse
maxomega3 is not online. maxomega3
Joined: 11 Jun 2010
Total Posts: 10668
17 Dec 2014 06:52 PM
Call them anything.
You use the color when you find the players on that team. I think I used "Really blue", but you can change it to whatever
Report Abuse
TheBestAccountEver is not online. TheBestAccountEver
Joined: 21 Aug 2013
Total Posts: 139
17 Dec 2014 06:53 PM
k
Report Abuse
maxomega3 is not online. maxomega3
Joined: 11 Jun 2010
Total Posts: 10668
17 Dec 2014 06:53 PM
red,
I used "Really red"
Report Abuse
TheBestAccountEver is not online. TheBestAccountEver
Joined: 21 Aug 2013
Total Posts: 139
17 Dec 2014 06:55 PM
wait,

how do I add a team when they deleted the teams folder



why did they do that?
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Game Design
   
 
   
  • 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