Hello. I'm trying to make an auto death teleporter but it's not working. It says Vector3 is not a valid member of Part and it just won't work.
local plr = game.Players.iiDkOffical local character = plr.Character character:WaitForChild("Humanoid").Died:Connect(function() local pos1 = character.HumanoidRootPart.Position plr:LoadCharacter() wait(0.11) character.HumanoidRootPart.Vector3 = Vector3.new(pos1) end)
you can't do HumanoidRootPart.Vector3
.. I think you meant to do HumanoidRootPart.Position
, which returns a Vector3
The property for the position is Position
, as you had it on line 4.
To make it work for all players, I would do it like this.
local Players = game:GetService("Players") Players.PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(character) local connection connection = character.Humanoid.Died:Connect(function() local last_cf = character:GetPrimaryPartCFrame() player:LoadCharacter() wait(0.1) character:SetPrimaryPartCFrame(last_cf) connection:Disconnect() end) end) end)
This also accounts for rotation. I also disconnect the connection when I am finished, to avoid a memory leak. A new connection will be remade, but only when they respawn.
replace line 7 with character.HumanoidRootPart.Position = Vector3.new(pos1)