Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Moving a Character !Help!

Asked by 10 years ago
wait(5)
local character = script.Parent.Parent.Character
local player = game.Players.LocalPlayer

local cam = game.Workspace.CurrentCamera
local coframe = cam.CoordinateFrame.p
local lvector = game.Workspace.CurrentCamera.CoordinateFrame.lookVector
--local focus = cam.Focus  --cant do because it has x,y,z,  r,o,t,a,t,i,o,n

-- attempt to find a container; create a new one if it doesn't exist
local container = Workspace:FindFirstChild("LocalBin")
if not container then
    container = Instance.new("Camera")
    container.Name = "LocalBin"
    container.Parent = Workspace
end

local character = game.Players.LocalPlayer.Character
character.Archivable = true
charactercopy = character:Clone()
charactercopy.Parent = container
charactercopy:MoveTo(Vector3.new(30,30,30)) 

print("ThisScript3")
while charactercopy ~= nil do
local lvector = game.Workspace.CurrentCamera.CoordinateFrame.lookVector
local coframe = cam.CoordinateFrame.p
--print(lvector)
--print(coframe)
charactercopy:MoveTo(Vector3.new(lvector*20 + coframe))     --20 is how far away from the camera        charactercopy:MoveTo( (lvector*20 + coframe )  )
wait(1)
end


I am trying to make a script that the character stays between the camera and where its looking. When I get to line 30 , (charactercopy:MoveToVector3.new(lvector*20 + coframe)) The copy just stays at 0,0,0 even though I keep on updating the lvector and coframe. How would I do this?

1 answer

Log in to vote
0
Answered by
Dom2d2 35
10 years ago

Your question is somewhat confusing, but I will try to help. Remember that with Vector3, there must be three numbers. In this line:

charactercopy:MoveTo(Vector3.new(lvector*20 + coframe)) 

You only good 2 numbers, lvector*20 is one number, and coframe is another number. You'll need a third coordinate to complete this, because it uses Vector3.

Ad

Answer this question