the game i'm making is a 1v1 game that picks 2 random people and teleports them into an arena. this script is supposed to teleport them back when one of them dies. The function fires, but the teleport script doesn't work. Any help?

    function EndGame()
        local players = game.Players:GetPlayers()
        local teleportPart = "RespawnPoint" --Change this to the name of your part.
        local char1 = game.Teams.Fighting1:GetPlayers()
        local char2 = game.Teams.Fighting2:GetPlayers()
        local hum1 = char1.Humanoid
        local hum2 = char2.Humanoid
        
        print ("the function has worked!")
        
        while char1.Died
               do print(char1.Name.." has died.")
                    print(char2.Name.." has won.")
                    wait(4)
                    char1.HumanoidRootPart.CFrame = CFrame.new(Vector3.new(267, 22.565, 216.5))
                    char2.HumanoidRootPart.CFrame = CFrame.new(Vector3.new(267, 22.565, 216.5))
                end
        
        
        while char2.Died
                do print(char2.Name.." has died.")
                    print(char1.Name.." has won.")
                    wait(4)
                    char1.HumanoidRootPart.CFrame = CFrame.new(Vector3.new(267, 22.565, 216.5))
                    char2.HumanoidRootPart.CFrame = CFrame.new(Vector3.new(267, 22.565, 216.5))
                end
        
    end

1 comment

0

I'd try Humanoid:MoveTo() rather than cframing a player's humanoidrootpart to a certain position.