generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: lookvector not a valid member

Previous Thread :: Next Thread 
doneyes is not online. doneyes
Joined: 21 Mar 2008
Total Posts: 3466
05 Jul 2013 02:49 PM
local Origin = Vector3.new(torso, game.Workspace.pos1)
local Look = Origin.lookVector
Brick1.CFrame = CFrame.new(Origin.p + Look * 9)
Report Abuse
grimm343 is not online. grimm343
Joined: 18 Sep 2008
Total Posts: 2796
05 Jul 2013 02:56 PM
lookVector is a property of CFrame.

local Origin = CFrame.new(torso,Workspace.pos1)

I'm assuming that torso is a Vector3.
Report Abuse
doneyes is not online. doneyes
Joined: 21 Mar 2008
Total Posts: 3466
05 Jul 2013 02:59 PM
It was that, but I got the error saying "Vector3 expected"
Report Abuse
grimm343 is not online. grimm343
Joined: 18 Sep 2008
Total Posts: 2796
05 Jul 2013 03:02 PM
What is 'torso'?
If that's not a Vector3, that's probably where your error is.

If not, then it's because I made a mistake in my correction. :P
local Origin = CFrame.new(torso,Workspace.pos1.Position)
Report Abuse
doneyes is not online. doneyes
Joined: 21 Mar 2008
Total Posts: 3466
05 Jul 2013 03:03 PM
torso is just a brick. Here is the error to full detail:

bad argument #1 to 'new' (Vector3 expected, got userdata)
Report Abuse
grimm343 is not online. grimm343
Joined: 18 Sep 2008
Total Posts: 2796
05 Jul 2013 03:06 PM
What is Origin supposed to become?

With CFrame.new(), you have several different choices.

CFrame.new(torso.Position)
That would create a new CFrame value with the Position of torso.

CFrame.new(torso.Position,Workspace.pos1.Position)
That would create a new CFrame value with the position of torso and its Front Face will be facing pos1's Position (looking at it).
Report Abuse
doneyes is not online. doneyes
Joined: 21 Mar 2008
Total Posts: 3466
05 Jul 2013 03:11 PM
Ah. I'll get back to you in a minute. I will try editing some stuff around.
Report Abuse
doneyes is not online. doneyes
Joined: 21 Mar 2008
Total Posts: 3466
05 Jul 2013 03:18 PM
no luck. I'm trying to get torso to move to another brick in a set path over an amount of time. Any clue? Lookvector isn't needed. I just need the position.
Report Abuse
grimm343 is not online. grimm343
Joined: 18 Sep 2008
Total Posts: 2796
05 Jul 2013 03:35 PM
You could make it face the direction it's moving in, then have it move forward, no?
Moving in the direction of a target is simple, like that.
This should help you out..

Brick1 = Workspace.Brick1 --The brick you're moving
p1 = Workspace.pos1
p2 = workspace.pos2
p3 = workspace.pos3
studs = 2 --studs per movement
wtime = .1 --time between movements
m = 8 --Error margin in studs (space between Brick1 and target position.. If too small compared to studs, it will keep moving past the target)

function MTo(p)
Brick1.CFrame = CFrame.new(Brick1.Position,p.Position)
repeat
Brick1.CFrame = Brick1.CFrame + Brick1.CFrame.lookVector*studs
wait(wtime)
until (Brick1.Position-p.Position).magnitude <= m
end

MTo(p1)
MTo(p2)
MTo(p3)
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image