Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why doesn't the player teleport when he dies?

Asked by 10 years ago
01game.Players.PlayerAdded:connect(function(player)
02    player.CharacterAdded:connect(function(character)
03local spawns = mapChosenClone.Spawns:GetChildren()
04    for i,v in pairs(game.Players:GetPlayers()) do --Problem
05        local name = v.Name
06        local check = game.Workspace:FindFirstChild(name)
07        if check then
08            local checkHumanoid = check:FindFirstChild("Humanoid")
09            if checkHumanoid then
10                check:MoveTo(spawns[i].Position)
11                end
12            end
13        end
14    end)
15end)

When the player respawns the player doesn't teleport. I'm pretty sure its the line where I put the comment. This is probably a stupid mistake but I forget things.

3 answers

Log in to vote
0
Answered by 10 years ago

Please do not hate me if this does not work p.p

01game.Players.PlayerAdded:connect(function(player)
02    player.CharacterAdded:connect(function(character)
03local spawns = mapChosenClone.Spawns:GetChildren()
04    for i,v in pairs(game.Players:GetPlayers()) do --Problem
05        local name = v.Name
06        local check = game.Workspace:FindFirstChild(name)
07        if check then
08            local checkHumanoid = check:FindFirstChild("Humanoid")
09            if checkHumanoid then
10                check.Parent.Torso.CFrame  =  CFrame.new(spawns[i].Position)
11                end
12            end
13        end
14    end)
15end)
0
at least you tried and didn't just copy the script and do nothing rabidhalofan12345 55 — 10y
Ad
Log in to vote
-1
Answered by 10 years ago

Because move to makes the humanoid 'walk to the position'. Set the CFrame of the torso.

Log in to vote
-2
Answered by 10 years ago
01game.Players.PlayerAdded:connect(function(player)
02    player.CharacterAdded:connect(function(character)
03local spawn = mapChosenClone.Spawns:GetChildren()
04    for i,v in pairs(game.Players:GetPlayers()) do --Problem
05        local name = v.Name
06        local check = game.Workspace:FindFirstChild(name)
07        if check then
08            local checkHumanoid = check:FindFirstChild("Humanoid")
09            if checkHumanoid then
10                check:MoveTo(spawns[i].Position)
11                end
12            end
13        end
14    end)
15end)

Hopefully this should work!

0
you changed nothing you just copied the script and pasted it back rabidhalofan12345 55 — 10y
0
spawns to spawn iDoctorW 0 — 10y

Answer this question