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 » Scripters
Home Search
 

Re: Looking the same direction as another brick

Previous Thread :: Next Thread 
greedyawesomeman is not online. greedyawesomeman
Joined: 18 Apr 2010
Total Posts: 1038
02 Oct 2016 02:55 PM
How would I make a brick have the same rotation as my characters torso?

CFrames seem complicated, kinda of struggled in trig in school.
Report Abuse
F18ACE is online. F18ACE
Joined: 24 Jun 2015
Total Posts: 4025
02 Oct 2016 02:56 PM
it's not that complicated actually. Do you have the base for the script? i.e. the part that tells the brick to follow in the first place
Report Abuse
Flux_Capacitor is not online. Flux_Capacitor
Joined: 07 Apr 2008
Total Posts: 45720
02 Oct 2016 02:59 PM
local primaryPartCFrame = character.PrimaryPart.CFrame
local charRot = primaryPartCFrame - primaryPartCFrame.p
brick.CFrame = charRot + brick.Position
Report Abuse
greedyawesomeman is not online. greedyawesomeman
Joined: 18 Apr 2010
Total Posts: 1038
02 Oct 2016 03:01 PM
This is what I've tried (Probably looks stupid for what I'm trying to do):

while wait() do
part.CFrame = part.CFrame * character.Torso.CFrame.Angles
end

I know there's a rotational component to a cframe, how do I tack that onto another one? This script doesn't rotate at block at all however it moves oddly.
Report Abuse
F18ACE is online. F18ACE
Joined: 24 Jun 2015
Total Posts: 4025
02 Oct 2016 03:06 PM
part.CFrame = character.Torso.CFrame

this should count for the rotation and position.
Report Abuse
greedyawesomeman is not online. greedyawesomeman
Joined: 18 Apr 2010
Total Posts: 1038
02 Oct 2016 03:08 PM
Yes but that would also put it in the same 3d position. Sorry I was unclear in my first post, I would like to rotate another part the same way but in a different location.
Report Abuse
ProgrammerA10 is not online. ProgrammerA10
Joined: 12 Jul 2015
Total Posts: 381
02 Oct 2016 03:11 PM

Code below (Just tested in studio it works great):


local part = script.Parent
local character = game.Players:WaitForChild("Player1").Character

while true do
part.Rotation = character.Torso.Rotation
wait()
end
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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