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: How do I change a players position while keeping two values?

Previous Thread :: Next Thread 
Dreamlike is not online. Dreamlike
Joined: 29 Feb 2012
Total Posts: 16147
20 Jun 2015 07:58 PM
In other words, how do I move a player in a certain direction while keeping the other two coordinates the same?
Report Abuse
iwishforpie1 is not online. iwishforpie1
Joined: 20 Mar 2011
Total Posts: 1423
20 Jun 2015 07:58 PM
(part).Position = Vector3.new(5,(part).Position.Y,(part).Position.Z)
Report Abuse
Jammer622 is not online. Jammer622
Joined: 19 Nov 2008
Total Posts: 1739
20 Jun 2015 08:00 PM
Simple,
Character:MoveTo(Character.Torso.Position + Vector3.new(X, Y, Z))
Granted that can also put your character on top of any blocks they end up colliding with.
To avoid that, you can use this,
Character.Torso.CFrame = Character.Torso.CFrame + Vector3.new(X, Y, Z)
That will also keep their current rotation.
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
20 Jun 2015 08:04 PM
How about using :Move???
Report Abuse
Jammer622 is not online. Jammer622
Joined: 19 Nov 2008
Total Posts: 1739
20 Jun 2015 08:05 PM
Note that changing a part's .Position will instantly break any joints it had with other parts.

If you want to move the character relative to the direction they're facing, use:

Character.Torso.CFrame = Character.Torso.CFrame + (Character.Torso.CFrame * Vector3.new(-Left/Right, -Down/Up, -Forward/Backward) - Character.Torso.Position).Unit
Report Abuse
Jammer622 is not online. Jammer622
Joined: 19 Nov 2008
Total Posts: 1739
20 Jun 2015 08:05 PM
:Move() is used to make the player's character walk in a specific direction. Is that what you're asking for?
Report Abuse
Dreamlike is not online. Dreamlike
Joined: 29 Feb 2012
Total Posts: 16147
20 Jun 2015 08:20 PM
No
Report Abuse
Dreamlike is not online. Dreamlike
Joined: 29 Feb 2012
Total Posts: 16147
20 Jun 2015 08:41 PM
Somethings wrong, Sometimes I appear to be a significant amount away from the value, only on the X value I am changing though.
Here the part of the script.
workspace.Player.Torso.CFrame = workspace.Player.Torso.CFrame + Vector3.new(-19.4, workspace.Player.Torso.Position.Y, workspace.Player.Torso.Position.Z)

Could a block be interfering?
Report Abuse
Jammer622 is not online. Jammer622
Joined: 19 Nov 2008
Total Posts: 1739
20 Jun 2015 08:45 PM
Nonono, change your Vector3 to (-19.4, 0, 0).
Remember, that's the value you're adding. If you add your original position, you're just doubling your distance from the center of your game.
Report Abuse
Dreamlike is not online. Dreamlike
Joined: 29 Feb 2012
Total Posts: 16147
20 Jun 2015 08:49 PM
oh

thanks
Report Abuse
Jammer622 is not online. Jammer622
Joined: 19 Nov 2008
Total Posts: 1739
20 Jun 2015 08:52 PM
Any time. Message me personally if you want my help again, otherwise I'm sure you can always get help from the others on this forum.
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