|
| 13 May 2014 08:29 PM |
So far, this is what I have. It teleports them to a random block, but I need a way for them to respawn on it.
function Teleport() Blks = Game.Workspace.Blocks:GetChildren() for i,v in pairs (Game.Players:GetPlayers()) do Name = v.Name Blk1 = Game.Workspace:FindFirstChild(Name) if Blk1 then Blk2 = Blk1:FindFirstChild("Humanoid") if Blk2 then v.Character.Humanoid.WalkSpeed = 0 v.Character:MoveTo(Blks[i].Position) wait(7) v.Character.Humanoid.WalkSpeed = 16 end end end end Teleport() |
|
|
| Report Abuse |
|
|
|
| 13 May 2014 08:30 PM |
Make a Object Value inside the Player called 'Spawn' and set the value to the part they are supposed to spawn to. When they respawn just have them spawn to the value of that ObjectValue- hence the finished result.
|
|
|
| Report Abuse |
|
|
|
| 13 May 2014 08:37 PM |
What do you mean by "Have them spawn to the objectvalue", how will it even respawn them? I've already followed your steps. Here's what I did to set it to a part:
Spawn.Value = Blks[math.random(1,#Blks)] -- Blks is already a varaible in the new script. |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 13 May 2014 08:38 PM |
CharacerAdded event MoveTo method (and just use the objectValue.Value.Position) |
|
|
| Report Abuse |
|
|
|
| 13 May 2014 08:40 PM |
Here's what I put. It doesn't work though:
local Spawn = Instance.new("ObjectValue") Spawn.Parent = v Spawn.Name = "Spawn" Spawn.Value = Blks[math.random(1,#Blks)] |
|
|
| Report Abuse |
|
|
|
| 13 May 2014 08:42 PM |
Okay so heres the idea,
PartsTab={Part1,Part2,Part3}
game.Players.PlayerAdded:connect(function(Player)
Player.CharacterAdded:connect(function(ch)
if Player:FindFirstChild'Spawn'==nil then local sp=Instance.new('ObjectValue',Player) sp.Name='Spawn' sp.Value=PartsTab[math.random(1,#PartsTab)] elseif Player:FindFirstChild'Spawn'~=nil and Player.Spawn.Value~=nil then ch.Torso.CFrame=Player.Spawn.Value.CFrame+CFrame.new(0,5,0) elseif Player:FindFirstChild'Spawn'~=nil and Player.Spawn.Value==nil then Player.Spawn.Value=PartsTab[math.random(1,#PartsTab)] ch.Torso.CFrame=Player.Spawn.Value.CFrame+CFrame.new(0,5,0) end
end) end)
that should take care of you. |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 13 May 2014 08:42 PM |
| Now you need to connect a characteradded event and actually move them |
|
|
| Report Abuse |
|
|
|
| 13 May 2014 08:49 PM |
| Workspace.Script:9: bad argument #2 to 'random' (interval is empty) |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 14 May 2014 12:44 AM |
| That means argument2 is less than argument1 (or argument2 is 0) |
|
|
| Report Abuse |
|
|