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: Could somebody try and fix this please?

Previous Thread :: Next Thread 
Verkauf is not online. Verkauf
Joined: 22 May 2009
Total Posts: 12965
28 Apr 2014 04:29 PM
I know it's most likely COMPLETELY wrong and will probably want to make you punch yourself in the face because that's how bad it is, but this is meant to:
1. Change team to the white team when you die
2. Load in a random map from a choice of two
3. detect if team1 or team2 has any players alive, if all the players on one team are dead then the other team wins and the map get's deleted.
4. if the playercount isn't 1> then a message with come up telling the player that 2 or more are needed to start
5. this then repeats for the second map

Here it is (prepare to facepalm xD)

for i,v in pairs(game.Players:GetChildren()) do
if v.TeamColor ~= BrickColor.new("White") then
v.Character.Humanoid.Died:connect(function()
v.TeamColor = BrickColor.new("White")
end)
end
end

while true do
local msg = Instance.New("Hint")
local map1 = game.Lighting["daystore"]
local map2 = game.Lighting["nightstore"]
local rand = math.random(1,2)
if rand == 1 and playercount == 1> then
local mc = map1:clone()
mc.Parent = game.Workspace.mapmat
msg.Parent = game.Workspace
msg.Text = "The map Store (Day) has been chosen."
wait(3)
msg.parent = nil
game.Teams.team1:GetChildren()
if value == 0 then
msg.Parent = game.Workspace
msg.Text = "team2 have won"
wait (3)
msg.parent = nil
mc:remove()
or
game.Teams.team2:GetChildren()
if value == 0 then
msg.Parent = game.Workspace
msg.Text = "team1 have won"
wait (3)
msg.parent = nil
mc:remove()
else
msg.Parent = game.Workspace
msg.Text = "2 Players are needed to start the game"
if playercount == 1> then
wait (3)
msg.parent = nil
elseif rand == 2 and playercount == 1> then
local mc = map2:clone()
mc.Parent = game.Workspace.mapmat
msg.Parent = game.Workspace
msg.Text = "The map 'Store (Night)' has been chosen."
wait(3)
msg.parent = nil
game.Teams.team1:GetChildren()
if value == 0 then
msg.Parent = game.Workspace
msg.Text = "team2 have won"
wait (3)
msg.parent = nil
mc:remove()
or
game.Teams.team2:GetChildren()
if value == 0 then
msg.Parent = game.Workspace
msg.Text = "team1 have won"
wait (3)
msg.parent = nil
mc:remove()
else
msg.Parent = game.Workspace
msg.Text = "2 Players are needed to start the game"
if playercount == 1> then
wait (3)
msg.parent = nil
end

- ESPURRED IS A BAE YO
Report Abuse
Duelingwarlord is not online. Duelingwarlord
Joined: 15 Feb 2010
Total Posts: 22333
28 Apr 2014 04:29 PM
tl;dr
Report Abuse
ScriptingHelperTroll is not online. ScriptingHelperTroll
Joined: 04 Apr 2014
Total Posts: 58
28 Apr 2014 04:30 PM
if yew od me i fix foa yew
Report Abuse
Verkauf is not online. Verkauf
Joined: 22 May 2009
Total Posts: 12965
28 Apr 2014 04:42 PM
;-;
somebody please

- ESPURRED IS A BAE YO
Report Abuse
SenseiWarrior is not online. SenseiWarrior
Joined: 09 Apr 2011
Total Posts: 12140
28 Apr 2014 04:46 PM
I fixed the first chunk.

for i,v in pairs(game.Players:GetChildren()) do
if v.TeamColor ~= "White" then
v.Character.Humanoid.Died:connect(function()
v.TeamColor = "White"
end)
end
end

--Dont use BrickColor when checking, just use the string.
Report Abuse
Verkauf is not online. Verkauf
Joined: 22 May 2009
Total Posts: 12965
28 Apr 2014 04:47 PM
@sensei

Thanks
do you think you could help with the rest? Sorry it's so badly made

- ESPURRED IS A BAE YO
Report Abuse
SenseiWarrior is not online. SenseiWarrior
Joined: 09 Apr 2011
Total Posts: 12140
28 Apr 2014 04:57 PM
Im not sure if this'll work, but I guess try..

while true do
local msg = Instance.New("Hint")
local map1 = game.Lighting["daystore"]
local map2 = game.Lighting["nightstore"]
local rand = math.random(1,2)
if rand == 1 and game.Players.NumPlayers > 1 then
local mc = map1:Clone()
mc.Parent = game.Workspace.mapmat
msg.Parent = game.Workspace
msg.Text = "The map " .. map1.Name .. " has been chosen."
wait(3)
msg:Destroy()
if game.Teams['team1']:GetChildren() == 0 then
msg.Parent = game.Workspace
msg.Text = "team2 have won"
wait(3)
msg:Destroy()
mc:Destroy()
if game.Teams['team2']:GetChildren() == 0 then
msg.Parent = game.Workspace
msg.Text = "team1 have won"
wait(3)
msg:Destroy()
mc:Destroy()
if playercount > 1 then
wait(3)
msg:Destroy()
elseif rand == 2 and playercount > 1 then
local mc2 = map2:clone()
mc2.Parent = game.Workspace.mapmat
msg.Parent = game.Workspace
msg.Text = "The map " .. map2.Name .. " has been chosen."
wait(3)
msg:Destroy()
if game.Teams['team1']:GetChildren() == 0 then
msg.Parent = game.Workspace
msg.Text = "team2 have won"
wait(3)
msg:Destroy()
mc2:Destroy()
if game.Teams['team2']:GetChildren() == 0 then
msg.Parent = game.Workspace
msg.Text = "team1 have won"
wait(3)
msg:Destroy()
mc2:Destroy()
if playercount > 1 then
wait(3)
msg:Destroy()
end
end
end
end
end
end
else
msg.Parent = Workspace
msg.Text = "You need 2 or more people to start the game."
end
end
Report Abuse
Verkauf is not online. Verkauf
Joined: 22 May 2009
Total Posts: 12965
28 Apr 2014 05:08 PM
Thankyou, it has no errors and seems like it should work, but I'm gonna need a script that teleports players to the spawns, so would you help me test it when I manage to do that?

- ESPURRED IS A BAE YO
Report Abuse
SenseiWarrior is not online. SenseiWarrior
Joined: 09 Apr 2011
Total Posts: 12140
28 Apr 2014 05:12 PM
for _, v in pairs(game.Players:GetChildren()) do
v.Character.Torso.CFrame = CFrame.new(0,0,0) --position
end
Report Abuse
Verkauf is not online. Verkauf
Joined: 22 May 2009
Total Posts: 12965
28 Apr 2014 05:15 PM
Would it not be easier to to randomly split the players into two teams (team1 and team2) then kill everybody, because then they will spawn at the spawn locations?

- ESPURRED IS A BAE YO
Report Abuse
Verkauf is not online. Verkauf
Joined: 22 May 2009
Total Posts: 12965
28 Apr 2014 05:22 PM
i'm not sure how to randomly split players, kill everybody or even more teams though ;-;

#CertifiedNOOB

- ESPURRED IS A BAE YO
Report Abuse
SenseiWarrior is not online. SenseiWarrior
Joined: 09 Apr 2011
Total Posts: 12140
28 Apr 2014 06:21 PM
for _, v in pairs(game.Players:GetChildren()) do
if v.TeamColor == "Bright red" then --team color
v.Character.Torso.CFrame = CFrame.new(0,0,0) --position
elseif v.TeamColor == "Bright blue" then --team color
v.Character.Torso.CFrame = CFrame.new(0,0,0) --position
else
print("wher do ey tele dis nob??")
end
end
Report Abuse
Verkauf is not online. Verkauf
Joined: 22 May 2009
Total Posts: 12965
28 Apr 2014 06:22 PM
@sen
dat print doe c;
But that doesn't randomly split them does it?

- ESPURRED IS A BAE YO
Report Abuse
SenseiWarrior is not online. SenseiWarrior
Joined: 09 Apr 2011
Total Posts: 12140
28 Apr 2014 06:23 PM
That just teleports them depending on their Team Color.
Report Abuse
Verkauf is not online. Verkauf
Joined: 22 May 2009
Total Posts: 12965
28 Apr 2014 06:27 PM
Ah, no, I must explained badly I'm sorry.
Players start off on the white team (The lobby, spectators)
I then want them to randomly get split into two teams and then die, this will make it easier because they are moved to a new team, and then reset, so they spawn at the teams spawn, I just don't know how to get them to split randomly, kill them, or where I would put this in the script you fixed for me (thanks for that)

- ESPURRED IS A BAE YO
Report Abuse
SenseiWarrior is not online. SenseiWarrior
Joined: 09 Apr 2011
Total Posts: 12140
28 Apr 2014 06:28 PM
team1color = "Bright red" --team 1 team color
team2color = "Bright blue" --team 2 team color
for _, v in pairs(game.Players:GetChildren()) do
if game.Teams['team1']:GetChildren() > game.Teams['team2']:GetChildren() then
v.TeamColor = team2color
elseif game.Teams['team2']:GetChildren() > game.Teams['team1']:GetChildren() then
v.TeamColor = team1color
elseif game.Teams['team1']:GetChildren() == game.Teams['team2']:GetChildren()
mr = math.random(1,2)
if mr == 1 then
v.TeamColor = team1color
elseif mr == 2 then
v.TeamColor = team2color
end
end
wait()

-- put this before the teleporting thing
Report Abuse
Verkauf is not online. Verkauf
Joined: 22 May 2009
Total Posts: 12965
28 Apr 2014 06:34 PM
@sensei
Now I've implemented the actual team names, I edited them wrong, however the "mr = math.random(1,2) gets an error.
This is probably my fault as I've probably put it in the wrong place or something because I'm me
Sorry if I've done this wrong, correct me if so please:

while true do
local msg = Instance.New("Hint")
local map1 = game.Lighting["DayStore"]
local map2 = game.Lighting["NightStore"]
local rand = math.random(1,2)
Criminalscolor = "Bright red"
Policecolor = "Bright blue"
for _, v in pairs(game.Players:GetChildren()) do
if game.Teams['Criminals']:GetChildren() > game.Teams['Police']:GetChildren() then
v.TeamColor = Policecolor
elseif game.Teams['Police']:GetChildren() > game.Teams['Criminals']:GetChildren() then
v.TeamColor = Criminalscolor
elseif game.Teams['Criminals']:GetChildren() == game.Teams['Police']:GetChildren()
mr = math.random(1,2)
if mr == 1 then
v.TeamColor = team1color
elseif mr == 2 then
v.TeamColor = team2color
end
end
wait()
if rand == 1 and game.Players.NumPlayers > 1 then
local mc = map1:Clone()
mc.Parent = game.Workspace.mapmat
msg.Parent = game.Workspace
msg.Text = "The map " .. map1.Name .. " has been chosen."
wait(3)
msg:Destroy()
if game.Teams['Police']:GetChildren() == 0 then
msg.Parent = game.Workspace
msg.Text = "The Criminals have won!"
wait(3)
msg:Destroy()
mc:Destroy()
if game.Teams['Criminals']:GetChildren() == 0 then
msg.Parent = game.Workspace
msg.Text = "The Police have won!"
wait(3)
msg:Destroy()
mc:Destroy()
if playercount > 1 then
wait(3)
msg:Destroy()
elseif rand == 2 and playercount > 1 then
local mc2 = map2:clone()
mc2.Parent = game.Workspace.mapmat
msg.Parent = game.Workspace
msg.Text = "The map " .. map2.Name .. " has been chosen."
wait(3)
msg:Destroy()
if game.Teams['Police']:GetChildren() == 0 then
msg.Parent = game.Workspace
msg.Text = "The Criminals have won!"
wait(3)
msg:Destroy()
mc2:Destroy()
if game.Teams['Criminals']:GetChildren() == 0 then
msg.Parent = game.Workspace
msg.Text = "The Police have won!"
wait(3)
msg:Destroy()
mc2:Destroy()
if playercount > 1 then
wait(3)
msg:Destroy()
end
end
end
end
end
end
else
msg.Parent = Workspace
msg.Text = "You need 2 or more people to start the game."
end
end


- ESPURRED IS A BAE YO
Report Abuse
SenseiWarrior is not online. SenseiWarrior
Joined: 09 Apr 2011
Total Posts: 12140
28 Apr 2014 06:37 PM
while wait() do
local msg = Instance.New("Hint")
local map1 = game.Lighting["DayStore"]
local map2 = game.Lighting["NightStore"]
local rand = math.random(1,2)
Criminalscolor = "Bright red"
Policecolor = "Bright blue"
for _, v in pairs(game.Players:GetChildren()) do
if game.Teams['Criminals']:GetChildren() > game.Teams['Police']:GetChildren() then
v.TeamColor = Policecolor
elseif game.Teams['Police']:GetChildren() > game.Teams['Criminals']:GetChildren() then
v.TeamColor = Criminalscolor
elseif game.Teams['Criminals']:GetChildren() == game.Teams['Police']:GetChildren()
mraa = math.random(1,2)
if mraa == 1 then
v.TeamColor = team1color
elseif mraa == 2 then
v.TeamColor = team2color
end
end
wait()
if rand == 1 and game.Players.NumPlayers > 1 then
local mc = map1:Clone()
mc.Parent = game.Workspace.mapmat
msg.Parent = game.Workspace
msg.Text = "The map " .. map1.Name .. " has been chosen."
wait(3)
msg:Destroy()
if game.Teams['Police']:GetChildren() == 0 then
msg.Parent = game.Workspace
msg.Text = "The Criminals have won!"
wait(3)
msg:Destroy()
mc:Destroy()
if game.Teams['Criminals']:GetChildren() == 0 then
msg.Parent = game.Workspace
msg.Text = "The Police have won!"
wait(3)
msg:Destroy()
mc:Destroy()
if playercount > 1 then
wait(3)
msg:Destroy()
elseif rand == 2 and playercount > 1 then
local mc2 = map2:clone()
mc2.Parent = game.Workspace.mapmat
msg.Parent = game.Workspace
msg.Text = "The map " .. map2.Name .. " has been chosen."
wait(3)
msg:Destroy()
if game.Teams['Police']:GetChildren() == 0 then
msg.Parent = game.Workspace
msg.Text = "The Criminals have won!"
wait(3)
msg:Destroy()
mc2:Destroy()
if game.Teams['Criminals']:GetChildren() == 0 then
msg.Parent = game.Workspace
msg.Text = "The Police have won!"
wait(3)
msg:Destroy()
mc2:Destroy()
if playercount > 1 then
wait(3)
msg:Destroy()
end
end
end
end
end
end
else
msg.Parent = Workspace
msg.Text = "You need 2 or more people to start the game."
end
end

--try this i guess
Report Abuse
Verkauf is not online. Verkauf
Joined: 22 May 2009
Total Posts: 12965
28 Apr 2014 06:39 PM
"mraa = math.random(1,2)"
has an error ;-;

- ESPURRED IS A BAE YO
Report Abuse
SenseiWarrior is not online. SenseiWarrior
Joined: 09 Apr 2011
Total Posts: 12140
28 Apr 2014 06:40 PM
while wait() do
local msg = Instance.New("Hint")
local map1 = game.Lighting["DayStore"]
local map2 = game.Lighting["NightStore"]
local rand = math.random(1,2)
Criminalscolor = "Bright red"
Policecolor = "Bright blue"
for _, v in pairs(game.Players:GetChildren()) do
if game.Teams['Criminals']:GetChildren() > game.Teams['Police']:GetChildren() then
v.TeamColor = Policecolor
elseif game.Teams['Police']:GetChildren() > game.Teams['Criminals']:GetChildren() then
v.TeamColor = Criminalscolor
elseif game.Teams['Criminals']:GetChildren() == game.Teams['Police']:GetChildren()
if rand == 1 then
v.TeamColor = team1color
elseif rand == 2 then
v.TeamColor = team2color
end
end
wait()
if rand == 1 and game.Players.NumPlayers > 1 then
local mc = map1:Clone()
mc.Parent = game.Workspace.mapmat
msg.Parent = game.Workspace
msg.Text = "The map " .. map1.Name .. " has been chosen."
wait(3)
msg:Destroy()
if game.Teams['Police']:GetChildren() == 0 then
msg.Parent = game.Workspace
msg.Text = "The Criminals have won!"
wait(3)
msg:Destroy()
mc:Destroy()
if game.Teams['Criminals']:GetChildren() == 0 then
msg.Parent = game.Workspace
msg.Text = "The Police have won!"
wait(3)
msg:Destroy()
mc:Destroy()
if playercount > 1 then
wait(3)
msg:Destroy()
elseif rand == 2 and playercount > 1 then
local mc2 = map2:clone()
mc2.Parent = game.Workspace.mapmat
msg.Parent = game.Workspace
msg.Text = "The map " .. map2.Name .. " has been chosen."
wait(3)
msg:Destroy()
if game.Teams['Police']:GetChildren() == 0 then
msg.Parent = game.Workspace
msg.Text = "The Criminals have won!"
wait(3)
msg:Destroy()
mc2:Destroy()
if game.Teams['Criminals']:GetChildren() == 0 then
msg.Parent = game.Workspace
msg.Text = "The Police have won!"
wait(3)
msg:Destroy()
mc2:Destroy()
if playercount > 1 then
wait(3)
msg:Destroy()
end
end
end
end
end
end
else
msg.Parent = Workspace
msg.Text = "You need 2 or more people to start the game."
end
end
Report Abuse
Verkauf is not online. Verkauf
Joined: 22 May 2009
Total Posts: 12965
28 Apr 2014 06:42 PM
Now "if rand == 1 then" has an error xD

- ESPURRED IS A BAE YO
Report Abuse
SenseiWarrior is not online. SenseiWarrior
Joined: 09 Apr 2011
Total Posts: 12140
28 Apr 2014 06:43 PM
while wait() do
msg = Instance.New("Hint")
map1 = game.Lighting["DayStore"]
map2 = game.Lighting["NightStore"]
rand = math.random(1,2)
Criminalscolor = "Bright red"
Policecolor = "Bright blue"
for _, v in pairs(game.Players:GetChildren()) do
if game.Teams['Criminals']:GetChildren() > game.Teams['Police']:GetChildren() then
v.TeamColor = Policecolor
elseif game.Teams['Police']:GetChildren() > game.Teams['Criminals']:GetChildren() then
v.TeamColor = Criminalscolor
elseif game.Teams['Criminals']:GetChildren() == game.Teams['Police']:GetChildren()
mraa = math.random(1,2)
if mraa == 1 then
v.TeamColor = team1color
elseif mraa == 2 then
v.TeamColor = team2color
end
end
wait()
if rand == 1 and game.Players.NumPlayers > 1 then
local mc = map1:Clone()
mc.Parent = game.Workspace.mapmat
msg.Parent = game.Workspace
msg.Text = "The map " .. map1.Name .. " has been chosen."
wait(3)
msg:Destroy()
if game.Teams['Police']:GetChildren() == 0 then
msg.Parent = game.Workspace
msg.Text = "The Criminals have won!"
wait(3)
msg:Destroy()
mc:Destroy()
if game.Teams['Criminals']:GetChildren() == 0 then
msg.Parent = game.Workspace
msg.Text = "The Police have won!"
wait(3)
msg:Destroy()
mc:Destroy()
if playercount > 1 then
wait(3)
msg:Destroy()
elseif rand == 2 and playercount > 1 then
local mc2 = map2:clone()
mc2.Parent = game.Workspace.mapmat
msg.Parent = game.Workspace
msg.Text = "The map " .. map2.Name .. " has been chosen."
wait(3)
msg:Destroy()
if game.Teams['Police']:GetChildren() == 0 then
msg.Parent = game.Workspace
msg.Text = "The Criminals have won!"
wait(3)
msg:Destroy()
mc2:Destroy()
if game.Teams['Criminals']:GetChildren() == 0 then
msg.Parent = game.Workspace
msg.Text = "The Police have won!"
wait(3)
msg:Destroy()
mc2:Destroy()
if playercount > 1 then
wait(3)
msg:Destroy()
end
end
end
end
end
end
else
msg.Parent = Workspace
msg.Text = "You need 2 or more people to start the game."
end
end
Report Abuse
Verkauf is not online. Verkauf
Joined: 22 May 2009
Total Posts: 12965
28 Apr 2014 06:45 PM
"mraa = math.random(1,2)" has an error again
do you know what's wrong with it?:o

- ESPURRED IS A BAE YO
Report Abuse
SenseiWarrior is not online. SenseiWarrior
Joined: 09 Apr 2011
Total Posts: 12140
28 Apr 2014 06:49 PM
while wait() do
msg = Instance.New("Hint")
map1 = game.Lighting["DayStore"]
map2 = game.Lighting["NightStore"]
rand = math.random(1,2)
Criminalscolor = "Bright red"
Policecolor = "Bright blue"
for _, v in pairs(game.Players:GetChildren()) do
if game.Teams['Criminals']:GetChildren() > game.Teams['Police']:GetChildren() then
v.TeamColor = Policecolor
elseif game.Teams['Police']:GetChildren() > game.Teams['Criminals']:GetChildren() then
v.TeamColor = Criminalscolor
elseif game.Teams['Criminals']:GetChildren() == game.Teams['Police']:GetChildren()
if rand == 1 then
v.TeamColor = team1color
elseif rand == 2 then
v.TeamColor = team2color
end
end
wait()
if rand == 1 and game.Players.NumPlayers > 1 then
local mc = map1:Clone()
mc.Parent = game.Workspace.mapmat
msg.Parent = game.Workspace
msg.Text = "The map " .. map1.Name .. " has been chosen."
wait(3)
msg:Destroy()
if game.Teams['Police']:GetChildren() == 0 then
msg.Parent = game.Workspace
msg.Text = "The Criminals have won!"
wait(3)
msg:Destroy()
mc:Destroy()
if game.Teams['Criminals']:GetChildren() == 0 then
msg.Parent = game.Workspace
msg.Text = "The Police have won!"
wait(3)
msg:Destroy()
mc:Destroy()
if playercount > 1 then
wait(3)
msg:Destroy()
elseif rand == 2 and playercount > 1 then
local mc2 = map2:clone()
mc2.Parent = game.Workspace.mapmat
msg.Parent = game.Workspace
msg.Text = "The map " .. map2.Name .. " has been chosen."
wait(3)
msg:Destroy()
if game.Teams['Police']:GetChildren() == 0 then
msg.Parent = game.Workspace
msg.Text = "The Criminals have won!"
wait(3)
msg:Destroy()
mc2:Destroy()
if game.Teams['Criminals']:GetChildren() == 0 then
msg.Parent = game.Workspace
msg.Text = "The Police have won!"
wait(3)
msg:Destroy()
mc2:Destroy()
if playercount > 1 then
wait(3)
msg:Destroy()
end
end
end
end
end
end
else
msg.Parent = Workspace
msg.Text = "You need 2 or more people to start the game."
end
end
Report Abuse
Verkauf is not online. Verkauf
Joined: 22 May 2009
Total Posts: 12965
28 Apr 2014 06:51 PM
"if rand == 1 then"
error:(

- ESPURRED IS A BAE YO
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