So, I have a script that is supposed to teleport a player to a certain position once they die. However, I am getting a "Position cannot be assigned to" error. Here is the code:
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if hit.Parent:FindFirstChild("Humanoid") then
while wait(0.1) do
while wait(0.1) do -- I have 2 loops to make it go a lot longer
if player.Character.Humanoid.Health == 0 then
wait(6)
player.Character.HumanoidRootPart.CFrame.Position = Vector3.new(1, 2, 3)
end
end
end
end
Thanks in advance for any help!

2 comments
Thanks, but no thanks. When I try that, it only teleports the HumanoidRootPart (which the Character desperately needs) and glitches the Character.
NVM!!! Thank you so much! I realized when I tried that I accidentally wrote a s! Thank you again!