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

Can I use Vector3 like this?

If I want to move this part to where the character's head is, can I do this?

local FlagClone = game:GetService("ServerStorage"):WaitForChild("RedFlag"):Clone()--the flag gets cloned and put into workspace
        FlagClone.Parent = game.Workspace
		FlagClone.Handle.Position = Vector3.new("char.Head", "char.Head", "char.Head")

1 answer

✓ Accepted answer

No, you cannot do it like that. The arguments of Vector3[3 arguments get it] are numbers, not strings We can shorten 3 arguments [if you wanted to use X,Y,Z of the head] You could use head.Position Plus head isn't declared, that is something you gotta do

-- This is a Server Script in ServerScriptService
local function putFlagOnHead(hit)
	local FlagClone = game:GetService("ServerStorage"):WaitForChild("RedFlag"):Clone()--the 	flag gets cloned and put into workspace	
	local char = hit.Parent -- hit.Parent's class is a model
	local head = char:WaitForChild("Head") -- Class is a part
	FlagClone.Parent = game.Workspace
	FlagClone.Handle.CFrame = CFrame.new(head.Position) -- Gets 	head.Position.X,head.Position.Y and head.Position.Z
end
	putFlagOnHead()

Please accept this answer if it helped, And if not, please don't hesitate to ask questions

12 comments

0

It says that Position isn't a valid member of part

0

Is head a model??

0

Or a part

0

Wait nvm I had a spelling problem, now its not saying anything in the output and the part isn't moving

0

Oh lemme fix the code

0

Head is the part of a character

0

Try using CFrame

0

Ok lemme fix the code once again

0

The first time you fixed the code was correct, I just tried it. Thanks!

0

Oh ok

0

Thank you for accepting

0

:)

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