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 » Scripters
Home Search
 

Re: how would i get the clone?

Previous Thread :: Next Thread 
bubbaman73 is not online. bubbaman73
Joined: 02 Feb 2013
Total Posts: 795
13 Jul 2015 02:50 AM
so im trying to delete the clone of the map but im not sure how.


while wait() do
wait(10)
workspace.LobbyMessage.Text = "Preparing..." -- we'll get fancy with GUIs later
local maps = game.ReplicatedStorage.Maps:GetChildren()
Map = maps[math.random(1,#maps)]
Map:Clone().Parent = workspace
wait(1)
workspace.LobbyMessage.Text = ""
for i,players in pairs(game.Players:GetPlayers()) do
players.Character.Torso.CFrame = CFrame.new(Map.Start.Position.X+i,Map.Start.Position.Y+12,Map.Start.Position.Z+i)
players.Character.Humanoid.WalkSpeed = 0
wait(2)
workspace.LobbyMessage.Text = "GO"
players.Character.Humanoid.WalkSpeed = 40
wait(.3)
workspace.LobbyMessage.Text = ""
Map.End.Script.EndTouched:FireServer()
Map:Destroy()
end
end



<3 cats <3
Report Abuse
mycheeze is not online. mycheeze
Joined: 27 Jun 2011
Total Posts: 6748
13 Jul 2015 02:58 AM
while wait() do
wait(10)
workspace.LobbyMessage.Text = "Preparing..." -- we'll get fancy with GUIs later
local maps = game.ReplicatedStorage.Maps:GetChildren()
local Map = maps[math.random(1,#maps)]
local NewMap = Map:Clone().Parent = workspace
wait(1)
workspace.LobbyMessage.Text = ""
for i,players in pairs(game.Players:GetPlayers()) do
players.Character.Torso.CFrame = CFrame.new(Map.Start.Position.X+i,Map.Start.Position.Y+12,Map.Start.Position.Z+i)
players.Character.Humanoid.WalkSpeed = 0
wait(2)
workspace.LobbyMessage.Text = "GO"
players.Character.Humanoid.WalkSpeed = 40
wait(.3)
workspace.LobbyMessage.Text = ""
Map.End.Script.EndTouched:FireServer()
NewMap:Destroy()
end
end
Report Abuse
lomo0987 is not online. lomo0987
Joined: 31 May 2008
Total Posts: 2461
13 Jul 2015 03:01 AM
Let me just clean up your script..

------------------------------------------
Message = Workspace.LobbyMessage
maps = game.ReplicatedStorage.Maps:GetChildren()

while true do -- Set this to true. :D
wait(10)
Message.Text = "Preparing..." -- Made that clean :D
Map = maps[math.random(1,#maps)]
Map:Clone().Parent = workspace
wait(1)
Message.Text = "" -- Clean :D
for i,players in pairs(game.Players:GetPlayers()) do
players.Character.Torso.CFrame = CFrame.new(Map.Start.Position.X+i,Map.Start.Position.Y+12,Map.Start.Position.Z+i)
players.Character.Humanoid.WalkSpeed = 0
wait(2)
workspace.LobbyMessage.Text = "GO"
players.Character.Humanoid.WalkSpeed = 40
wait(.3)
Message.Text = "" --Clean :D
Map.End.Script.EndTouched:FireServer() --Uhh.. What?
Map:Destroy() -- this should work :D
end
end
Report Abuse
bubbaman73 is not online. bubbaman73
Joined: 02 Feb 2013
Total Posts: 795
13 Jul 2015 03:01 AM
it doesnt like an equal sign in a variable


<3 cats <3
Report Abuse
bubbaman73 is not online. bubbaman73
Joined: 02 Feb 2013
Total Posts: 795
13 Jul 2015 03:03 AM
and i added a RemoteEvent in the 'End' with a script because i cant out functions in the loop


<3 cats <3
Report Abuse
bubbaman73 is not online. bubbaman73
Joined: 02 Feb 2013
Total Posts: 795
13 Jul 2015 03:06 AM
and while wait() do is much more efficient with while loops


<3 cats <3
Report Abuse
lomo0987 is not online. lomo0987
Joined: 31 May 2008
Total Posts: 2461
13 Jul 2015 03:08 AM
Really, by how much?

You would just get the clone the same way you made it's parent game.Workspace :D
Report Abuse
bubbaman73 is not online. bubbaman73
Joined: 02 Feb 2013
Total Posts: 795
13 Jul 2015 03:11 AM
it saves you a line of code instead of saying while true do wait(1) end

and what do you mean?


<3 cats <3
Report Abuse
lomo0987 is not online. lomo0987
Joined: 31 May 2008
Total Posts: 2461
13 Jul 2015 03:16 AM
Uhh, My waits are in different spots within a functions that are getting called :D So I don't really need to add a wait() instead of true.. Besides, if you name it to "Run" and have Run = true. if you ever make Run false you can stop the loop :D
Report Abuse
bubbaman73 is not online. bubbaman73
Joined: 02 Feb 2013
Total Posts: 795
13 Jul 2015 03:17 AM
so what do you mean by getting the clone?


<3 cats <3
Report Abuse
lomo0987 is not online. lomo0987
Joined: 31 May 2008
Total Posts: 2461
13 Jul 2015 03:19 AM
I forgot to add that XD

You named the clone "Map" in the script... So "Map" is the clone..

map = maps[math.random(1,#maps)] -- This names the map..
map.Parent = game.Workspace
map:Destroy() -- Removes the map :D
Report Abuse
bubbaman73 is not online. bubbaman73
Joined: 02 Feb 2013
Total Posts: 795
13 Jul 2015 03:19 AM
No, that deletes the stored one, not the clone


<3 cats <3
Report Abuse
lomo0987 is not online. lomo0987
Joined: 31 May 2008
Total Posts: 2461
13 Jul 2015 03:22 AM
Ohh, I see the problem, you forgot to name the clone.
ClonedMap = Map:Cloned().Parent = game.Workspace
ClonedMap:Destroy()
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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