|
| 28 Jan 2012 11:00 AM |
For some reason, my script won't teleport the players to the given place with this script. It runs perfectly up to the teleporting part, where the output tells me it's an unknown exception without giving me a line.
the script:
local maps={"Classic","Prisoners"} local teleport={Vector3.new(77, 217, 448.5),Vector3.new(-392, 134.2, 26)} local WaitTime=5 local GameLength=120 ----- while true do if game.Players.NumPlayers < 2 then return end local random=math.random(1,#maps) local RandomMap=maps[random] local players=game.Players:GetChildren() wait(WaitTime) game.Lighting:FindFirstChild(RandomMap):clone().Parent=game.Workspace wait(2) for p=1,#players do players[p].Character:MoveTo(teleport[random]+math.random(-3,3)) end wait(GameLength) wait(5) for i=1,#players do players[i].Character:BreakJoints() end wait(5) game.Workspace:FindFirstChild(RandomMap):remove() wait() end
---thanks for reading and trying to help me. I know I've posting a lot on the forums requesting help but I'm just trying to learn. :) |
|
|
| Report Abuse |
|
|
|
| 28 Jan 2012 11:02 AM |
| :MoveTo has probelms so just use players[p].Character.Torso.CFrame=teleport[math.random(1,#teleport) |
|
|
| Report Abuse |
|
|
| |
|
|
| 28 Jan 2012 11:05 AM |
teleport[random]+math.random(-3,3))
you cant add a number to a vector3value and also dont think math.random can do negatives...
teleport[random]+Vector3.new(math.random(0,6)-3,math.random(0,6)-3,math.random(0,6)-3) |
|
|
| Report Abuse |
|
|
|
| 28 Jan 2012 11:05 AM |
Still got an unknown exception when trying to replace it with players[p].Character.Torso.CFrame=teleport[math.random(1,#teleport)] |
|
|
| Report Abuse |
|
|
| |
|
|
| 28 Jan 2012 11:30 AM |
still, unknown exception using
for p=1,#players do players[p].Character:MoveTo(teleport[random]+Vector3.new(math.random(0,6)-3,math.random(0,6)-3,math.random(0,6)-3)) end
probably has to do with the :MoveTo again. |
|
|
| Report Abuse |
|
|
| |
|
|
| 28 Jan 2012 11:58 AM |
players[p].Character:MoveTo(Vector3.new(teleport[random]+Vector3.new(math.random(0,6)-3,math.random(0,6)-3,math.random(0,6)-3)))
try that maybe?
|
|
|
| Report Abuse |
|
|
|
| 28 Jan 2012 12:05 PM |
| Unknow exception, teleport already had a Vector3.new() in it already anyways. |
|
|
| Report Abuse |
|
|
|
| 28 Jan 2012 12:06 PM |
Is there a way to do it without using :MoveTo or the way an above poster did it?
Or is there maybe something else wrong with the script? :/ |
|
|
| Report Abuse |
|
|
|
| 28 Jan 2012 12:09 PM |
Just checked the script by leaving out the teleporting part and there's still an unknown exception, so it has to be something else :/
Still, everything runs up until the teleport part: the map clones from lighting to workspace and then nothing happens other than an unknown exception message in the output. |
|
|
| Report Abuse |
|
|
|
| 28 Jan 2012 12:13 PM |
local teleport={Vector3.new(77, 217, 448.5),Vector3.new(-392, 134.2, 26)} local maps={"Classic","Prisoners"} local random=math.random(1,#maps) local players=game.Players:GetChildren()
for p=1,#players do players[p].Character:MoveTo(Vector3.new(teleport[random]+Vector3.new(math.random(0,6)-3,math.random(0,6)-3,math.random(0,6)-3))) end
when i ran this it worked fine... you sure its this part that makes a error? |
|
|
| Report Abuse |
|
|
|
| 28 Jan 2012 12:17 PM |
local maps={"Classic","Prisoners"} local teleport={Vector3.new(77, 217, 448.5),Vector3.new(-392, 134.2, 26)} local WaitTime=5 local GameLength=120 ----- while true do if game.Players.NumPlayers < 1 then return end local random=math.random(1,#maps) local RandomMap=maps[random] local players=game.Players:GetChildren() wait(WaitTime) --game.Lighting:FindFirstChild(RandomMap):clone().Parent=game.Workspace wait(2) for p=1,#players do players[p].Character:MoveTo(Vector3.new(teleport[random]+Vector3.new(math.random(0,6)-3,math.random(0,6)-3,math.random(0,6)-3))) end wait(GameLength) wait(5) for i=1,#players do players[i].Character:BreakJoints() end wait(5) --game.Workspace:FindFirstChild(RandomMap):remove() wait() end
this script works fine for me(with the 2 clone parts from lighting stopped) |
|
|
| Report Abuse |
|
|
|
| 28 Jan 2012 12:21 PM |
| It has to be something outside of the script. I copied your script, put it in my script and ran it, still an unknown exception without teleporting me. |
|
|
| Report Abuse |
|
|
|
| 28 Jan 2012 12:23 PM |
| no idea what is wrong then |
|
|
| Report Abuse |
|
|
|
| 28 Jan 2012 12:28 PM |
Did the script teleport you?
I found the problem with the unknown exception, it was caused by another script being active at the same time.
Still, the script won't teleport me. It does everything else, however. |
|
|
| Report Abuse |
|
|
|
| 28 Jan 2012 12:33 PM |
try this:
while true do players[p].Character.Torso.Anchored = true oldposition = players[p].Character.Torso.Position players[p].Character:MoveTo(Vector3.new(teleport[random]+Vector3.new(math.random(0,6)-3,math.random(0,6)-3,math.random(0,6)-3))) if oldposition ~= players[p].Character.Torso.Position then break end wait() end
put this part instead of the teleport part you have right now |
|
|
| Report Abuse |
|
|
|
| 28 Jan 2012 12:38 PM |
I really don't get it.. It again does nothing..
Maybe it has to do with :MoveTo having problems? |
|
|
| Report Abuse |
|
|
|
| 28 Jan 2012 12:44 PM |
function teleportplayer(players) while true do players[p].Character.Torso.Anchored = true oldposition = players[p].Character.Torso.Position players[p].Character:MoveTo(Vector3.new(teleport[random]+Vector3.new(math.random(0,6)-3,math.random(0,6)-3,math.random(0,6)-3))) if oldposition ~= players[p].Character.Torso.Position then players[p].Character.Torso.Anchored = false print("Player Teleported") break end wait() end end
local maps={"Classic","Prisoners"} local teleport={Vector3.new(77, 217, 448.5),Vector3.new(-392, 134.2, 26)} local WaitTime=5 local GameLength=120 ----- while true do if game.Players.NumPlayers < 1 then return end local random=math.random(1,#maps) local RandomMap=maps[random] local players=game.Players:GetChildren() wait(WaitTime) game.Lighting:FindFirstChild(RandomMap):clone().Parent=game.Workspace wait(2) for p=1,#players do teleportplayer(player) end wait(GameLength) wait(5) for i=1,#players do players[i].Character:BreakJoints() end wait(5) game.Workspace:FindFirstChild(RandomMap):remove() wait() end
could you try that? |
|
|
| Report Abuse |
|
|
|
| 28 Jan 2012 12:56 PM |
Changed it around a bit until it gave no errors, but now it doesn't say anything in output and doesn't even get to spawn the map. I think it just has to do with the :MoveTo having problems.
Is there any way to do it without :MoveTo? |
|
|
| Report Abuse |
|
|
|
| 28 Jan 2012 12:58 PM |
CFrame the torso
players[p].Character.Torso.CFrame = CFrame.new(teleport[random]+Vector3.new(math.random(0,6)-3,math.random(0,6)-3,math.random(0,6)-3))
|
|
|
| Report Abuse |
|
|
|
| 28 Jan 2012 01:04 PM |
Wth.. No teleport, no output with CFraming.. I give up..
Anyways, thanks for the help, I really apreciate it. I have literally no idea what's wrong with the script. If anyone else wants to try and fix it, here's what i have right now:
local maps={"Classic","Prisoners"} local teleport={Vector3.new(77, 217, 448.5),Vector3.new(-392, 134.2, 26)} local WaitTime=5 local GameLength=120 ----- while true do if game.Players.NumPlayers > 1 then return end local random=math.random(1,#maps) local RandomMap=maps[random] local players=game.Players:GetChildren() wait(WaitTime) game.Lighting:FindFirstChild(RandomMap):clone().Parent=game.Workspace wait(2) for p=1,#players do while true do players[p].Character.Torso.Anchored = true oldposition = players[p].Character.Torso.Position players[p].Character:MoveTo(Vector3.new(teleport[random]+Vector3.new(math.random(0,6)-3,math.random(0,6)-3,math.random(0,6)-3))) if oldposition ~= players[p].Character.Torso.Position then break end wait() end end wait(GameLength) for i=1,#players do players[i].Character:BreakJoints() end wait(5) game.Workspace:FindFirstChild(RandomMap):remove() wait() end --thanks for the help again. |
|
|
| Report Abuse |
|
|