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
 

Something wrong with the TP function

Previous Thread :: Next Thread 
BladeXE is not online. BladeXE
Joined: 22 Dec 2012
Total Posts: 3857
25 Apr 2014 09:27 AM
--[[LezMakeAGame]]
plrs = game.Players:GetPlayers()
maps = game.Lighting:GetChildren()
function selectMAP()
local selectedMap = maps[math.random(1,#maps)]
selectedMap:clone().Parent = Workspace
name = selectedMap.Name
Workspace[selectedMap.Name].Name = "Map"
game.Workspace.Timer.Value = 301
print('1')
repeat
wait(1)
game.Workspace.Timer.Value = game.Workspace.Timer.Value - 1
until
game.Workspace.Timer.Value == 1 or plrs[2] == false
print'2'
----
m = Instance.new("Message", Workspace)
if plrs[2] == false then
m.Text = "The winner was: "..plrs[1]
wait(5)
m:Destroy()
selectedMap:Destroy()
script.Disabled = true
end
if game.Workspace.Timer.Value == 1 then
m.Text = "There was no winner, time ran out."
wait(5)
m:Destroy()
selectedMap:Destroy()
script.Disabled = true
end
print'3'
end
function tp()
local spawns = Workspace.Map.Spawns:GetChildren()
for i = 1, #plrs do
plrs[i]:MoveTo(spawns.i.Position)
print'5'
sword = game.ServerStorage["Sword"]:clone()
sword.Parent = plrs[i].Character
end
end
if Workspace.GoReady.Value == true then
selectMAP()
print'6'
tp()
print'7'
Workspace.GoReady.Value = false
end
while wait() do
for i,v in pairs(game.Players:GetPlayers()) do
if v.Character.Humanoid.Health == 0 then
table.remove(plrs,i)
print'4'
end
end
end

I can't seem to figure out whats wrong with the TP function
Report Abuse
MrChubbs is not online. MrChubbs
Joined: 14 Oct 2010
Total Posts: 4969
25 Apr 2014 09:30 AM
plrs[i]:MoveTo(spawns.i.Position)
should be
plrs.Character[i]:MoveTo(spawns[i].Position)
and you need to update the plrs table since you only got it at the beginning of the game when there where no players.
Report Abuse
MrChubbs is not online. MrChubbs
Joined: 14 Oct 2010
Total Posts: 4969
25 Apr 2014 09:30 AM
Typo'd.
plrs[i].Character:MoveTo(spawns[i].Position)
Report Abuse
BladeXE is not online. BladeXE
Joined: 22 Dec 2012
Total Posts: 3857
25 Apr 2014 09:33 AM
THANKYOU!
Report Abuse
BladeXE is not online. BladeXE
Joined: 22 Dec 2012
Total Posts: 3857
25 Apr 2014 09:40 AM
Didn't work
http://www.roblox.com/Laundry-Day-Sword-Fighting-Simulation-place?id=154145112
In 'LezMakeAGame'
Report Abuse
BladeXE is not online. BladeXE
Joined: 22 Dec 2012
Total Posts: 3857
25 Apr 2014 10:54 AM
Please..
Report Abuse
BladeXE is not online. BladeXE
Joined: 22 Dec 2012
Total Posts: 3857
25 Apr 2014 11:00 AM
ANYBODY?
Report Abuse
BladeXE is not online. BladeXE
Joined: 22 Dec 2012
Total Posts: 3857
25 Apr 2014 12:36 PM
If you guys help me I promise I'll never come back to SH.
Report Abuse
smiley599 is not online. smiley599
Joined: 23 Jan 2010
Total Posts: 21869
25 Apr 2014 12:39 PM
What numbers get printed?
Report Abuse
BladeXE is not online. BladeXE
Joined: 22 Dec 2012
Total Posts: 3857
25 Apr 2014 01:00 PM
everything but 5 and 4
Report Abuse
smiley599 is not online. smiley599
Joined: 23 Jan 2010
Total Posts: 21869
25 Apr 2014 01:41 PM
"for i = 1, #plrs do
plrs[i]:MoveTo(spawns.i.Position)
print'5'()"

Should be

"for i = 1, #plrs do
plrs[i].Character:MoveTo(spawns.i.Position)
print'5'()"
Report Abuse
BladeXE is not online. BladeXE
Joined: 22 Dec 2012
Total Posts: 3857
25 Apr 2014 02:42 PM
nope

--[[LezMakeAGame]]
wait(5)
plrs = game.Players:GetPlayers()
maps = game.Lighting:GetChildren()
function selectMAP()
local selectedMap = maps[math.random(1,#maps)]
selectedMap:clone().Parent = Workspace
name = selectedMap.Name
Workspace[selectedMap.Name].Name = "Map"
game.Workspace.Timer.Value = 301
print('1')
repeat
wait(1)
game.Workspace.Timer.Value = game.Workspace.Timer.Value - 1
until
game.Workspace.Timer.Value == 1 or plrs[2] == false
print'2'
----
m = Instance.new("Message", Workspace)
if plrs[2] == false then
m.Text = "The winner was: "..plrs[1].Name
wait(5)
m:Destroy()
Workspace.Map:Destroy()
script.Disabled = true
end
if game.Workspace.Timer.Value == 1 then
m.Text = "There was no winner, time ran out."
wait(5)
m:Destroy()
Workspace.Map:Destroy()
script.Disabled = true
end
print'3'
end
function tp()
local spawns = Workspace.Map.Spawns
i = 1
for i,v in pairs(plrs) do
v.Character:MoveTo(Workspace.Map.Spawns[i].Position+Vector3.new(0, 0, 0))
i = i+1
end
print'5'
end
if Workspace.GoReady.Value == true then
selectMAP()
print'6'
wait(0)
tp()
print'7'
wait(0)
Workspace.GoReady.Value = false
end
while wait() do
for i,v in pairs(game.Players:GetPlayers()) do
if v.Character.Humanoid.Health == 0 then
table.remove(plrs,i)
print'4'
end
end
end
Report Abuse
BladeXE is not online. BladeXE
Joined: 22 Dec 2012
Total Posts: 3857
25 Apr 2014 03:09 PM
HELP
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