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

Help With CFraming?

			local customer = game.ReplicatedStorage.Customer
			customer.Name = "Customer"
			customer.Parent = script.Parent
			customer:MoveTo(script.Parent.CustomerSpawner.CFrame + CFrame.new(0,5,0))

Whenever I try this, it says that it expected Vector3 but got CFrame

			local customer = game.ReplicatedStorage.Customer
			customer.Name = "Customer"
			customer.Parent = script.Parent
			customer:MoveTo(script.Parent.CustomerSpawner.CFrame + Vector3.new(0,5,0))

Then is said that it couldn't cast Coordinate Frame to Vector3

			local customer = game.ReplicatedStorage.Customer
			customer.Name = "Customer"
			customer.Parent = script.Parent
			customer:MoveTo(script.Parent.CustomerSpawner.Position + Vector3(0,5,0))

And this makes the customer spawn on the roof rather than where it's supposed to spawn... Some help please? EDIT: This is a model, not a single Part.

1 comment

0

MoveTo takes a Vector3, it moves the object to the specified Vector3 unless there is stuff in the way (It then moves it upwards to the roof), You should use SetPrimaryPartCFrame.

1 answer

✓ Accepted answer

The reason it spawned on the roof with this code:

local customer = game.ReplicatedStorage.Customer
customer.Name = "Customer"
customer.Parent = script.Parent
customer:MoveTo(script.Parent.CustomerSpawner.Position + Vector3(0,5,0))

Is because Vector3 has collision detection where as CFrame does not.

Try using this if you haven't already

local customer = game.ReplicatedStorage.Customer
customer.Name = "Customer"
customer.Parent = script.Parent
customer:SetPrimaryPartCFrame(CFrame.new(0,5,0))

Make sure to set the primary part of the model first though.

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