Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Roblox "Position cannot be assigned to" error?

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!

1 answer

✓ Accepted answer

Just do:

player.Character.HumanoidRootPart.Position = Vector3.new(1, 2, 3)

instead of:

player.Character.HumanoidRootPart.CFrame.Position = Vector3.new(1, 2, 3)

2 comments

0

Thanks, but no thanks. When I try that, it only teleports the HumanoidRootPart (which the Character desperately needs) and glitches the Character.

0

NVM!!! Thank you so much! I realized when I tried that I accidentally wrote a s! Thank you again!

This discussion is preserved as it was. New answers, comments, and votes are closed.