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: Why wont positioning work?

Previous Thread :: Next Thread 
Rethiux is not online. Rethiux
Joined: 14 Nov 2012
Total Posts: 1132
24 Mar 2014 06:47 PM
local Plr = script.Parent.Parent.Parent.Parent.Parent
local Tank = game.Lighting.Tank1
function Clone()
C1 = Tank:Clone()
C2 = C1:Clone()
C2.Parent = game.Workspace
C2:CreateJoints()
C2.CFrame = CFrame.new(Plr.Character.Head.CFrame + CFrame.new(0, 0, 10))
end

function onClickClone()
Clone()
end

script.Parent.MouseButton1Down:connect(onClickClone)






-Stravus Police Department- (C) Commissioner :: Join today!
Report Abuse
Rethiux is not online. Rethiux
Joined: 14 Nov 2012
Total Posts: 1132
24 Mar 2014 06:56 PM
Anyone?


-Stravus Police Department- (C) Commissioner :: Join today!
Report Abuse
killjoy37 is not online. killjoy37
Joined: 27 Aug 2008
Total Posts: 2821
24 Mar 2014 06:57 PM
I think this is what you're looking for.

C2.CFrame = Plr.Character.Head.CFrame + Plr.Character.Head.CFrame.lookVector*10

Also, unless Tank1 is one part, this still won't work because you can't set the model's CFrame like that. You'd want to use TranslateBy, which works a little differently.
Report Abuse
Rethiux is not online. Rethiux
Joined: 14 Nov 2012
Total Posts: 1132
24 Mar 2014 07:05 PM
How would I do that?

-Stravus Police Department- (C) Commissioner :: Join today!
Report Abuse
Rethiux is not online. Rethiux
Joined: 14 Nov 2012
Total Posts: 1132
24 Mar 2014 07:06 PM
And I was trying to get it to spawn infront of you.

-Stravus Police Department- (C) Commissioner :: Join today!
Report Abuse
Rethiux is not online. Rethiux
Joined: 14 Nov 2012
Total Posts: 1132
24 Mar 2014 07:22 PM
Well???

-Stravus Police Department- (C) Commissioner :: Join today!
Report Abuse
killjoy37 is not online. killjoy37
Joined: 27 Aug 2008
Total Posts: 2821
25 Mar 2014 03:41 PM
It's pretty straightforward if you read the wiki. TranslateBy will use the supplied vector3 as kind of a displacement. In other words, it won't go to the position you supply as you'd expect, but if you treat the model as the origin rather than the point (0,0,0), then you can pretend that translateby is moving the model to the point you supply. However, if you use that example then it's worth noting that the model's rotation is not taken into account (I believe) so say I supply the vector3 (1,0,0), it will move the object on the global x-axis as opposed to the model's x-axis (since it might be rotated).
Hopefully this made sense. In the end you'll want something like
C2.CFrame = Plr.Character.Head
C2:TranslateBy(Plr.Character.Head.CFrame.lookVector*10)
Report Abuse
vlekje513 is not online. vlekje513
Joined: 28 Dec 2010
Total Posts: 9057
25 Mar 2014 03:44 PM
Dont use lighting, use serverstorage.
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