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

?Vector3 is confused on behavior

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)

1 comment

0

Try CFrame instead :b

3 answers

you can't do HumanoidRootPart.Vector3.. I think you meant to do HumanoidRootPart.Position, which returns a Vector3

9 comments

0

nope, butyou're getting there

0

How do you have 880 reputation while giving crap answers.

2

"Vector3 is not a valid member of Part" means ur trying to index the property  Vector3 which is not defined on that object

0

what do you mean crap answer? where are your great answers? and your high reputation?

0

Low rep != low quality posts, my quality is pretty good bruh

2

Uh, I can definitely back void_node when I can say that he is quite correct. Vector3 is a userdata type, not a property.... Using .Position will return the assigned Vector3 as he said, you need to cast a Vector3 datatype to Position to modify it.

0

ur just toxic.. shut up.

0

Thanks @Feahren..

0

This is quite embarrassing for you two.

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.

1 comment

0

didn't work

replace line 7 with character.HumanoidRootPart.Position = Vector3.new(pos1)

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