Why am I getting this error message when I try to teleport a player?

Hi, i’m trying to teleport a player and I keep getting the error message:
’ Unable to assign property CFrame. CoordinateFrame expected, got Instance ’

			local function disconnectConnections(kills)
				if kills == 5 then
					for i, v in ipairs(connections) do

					if plr1CurrentKills == 5 then
						winner = player1
					elseif plr2CurrentKills == 5 then
						winner = player2			

					player1.RespawnLocation = game.Workspace.SpawnLocs.SpawnLocation1
					player2.RespawnLocation = game.Workspace.SpawnLocs.SpawnLocation1

					if winner == player1 then
					elseif winner == player2 then
					winner.character.HumanoidRootPart.CFrame = game.Workspace.SpawnLocs.SpawnLocation1

					plr1CurrentKills = 0
					plr2CurrentKills = 0

					game.Workspace["Sword Fighting Arenas"].Arena1.Monitor.Surface.MainFrame.Main.score_t1.Text = plr1CurrentKills
					game.Workspace["Sword Fighting Arenas"].Arena1.Monitor.Surface.MainFrame.Main.score_t2.Text = plr2CurrentKills
					game.Workspace["Sword Fighting Arenas"].Arena1.Monitor.Surface2.MainFrame.Main.score_t1.Text = plr1CurrentKills
					game.Workspace["Sword Fighting Arenas"].Arena1.Monitor.Surface2.MainFrame.Main.score_t2.Text = plr2CurrentKills

					part1.Transparency = 0
					part1.CanCollide = true
					part2.Transparency = 0
					part2.CanCollide = true
					return true

Thank you very much for any help

The problem is this line here:

winner.character.HumanoidRootPart.CFrame = game.Workspace.SpawnLocs.SpawnLocation1

The CFrame property of the HumanoidRootPart expects a CFrame type to be assigned to it. But SpawnLocation1 is an object, so it can’t be assigned to it.

Just read the CFrame property from the SpawnLocation1 object and this will work fine:

winner.character.HumanoidRootPart.CFrame = game.Workspace.SpawnLocs.SpawnLocation1.CFrame

1 Like

Thank you very much, have a great day!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.