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: How can I do this?

Previous Thread :: Next Thread 
doneyes is not online. doneyes
Joined: 21 Mar 2008
Total Posts: 3466
13 Dec 2012 01:12 PM
So not increasing the walkspeed, but add velocity in the direction the character's camera is facing. I can't up the walkspeed because I have BodyVelocity on the character and it's too strong for the character to move, so I need to create "artificial" movement.

Thanks!
Report Abuse
jelly134 is not online. jelly134
Joined: 25 Aug 2008
Total Posts: 1137
13 Dec 2012 01:17 PM
well you can get the camera direction by running this in a local script

facingCFrame = game.Workspace.CurrentCamera.CoordinateFrame.lookVector
Report Abuse
doneyes is not online. doneyes
Joined: 21 Mar 2008
Total Posts: 3466
13 Dec 2012 01:27 PM
hm how can I make a create a spawn a local script with that info in it?
Report Abuse
doneyes is not online. doneyes
Joined: 21 Mar 2008
Total Posts: 3466
13 Dec 2012 01:28 PM
I have a script that acts onTouch and I need this to be in the same script.
Report Abuse
jelly134 is not online. jelly134
Joined: 25 Aug 2008
Total Posts: 1137
13 Dec 2012 01:30 PM
The only way I can see you accessing the camera's direction after a touch event is to make a script inside of the touchscript that you then clone into the player, e.g.

script.Parent.Touched:connect(function(hit)
if hit.Parent["Humanoid"] then
s = script.WalkScript:clone()
s.Parent = game.Players:GetPlayerFromCharacter(hit.Parent)
end
end)
Report Abuse
doneyes is not online. doneyes
Joined: 21 Mar 2008
Total Posts: 3466
13 Dec 2012 01:47 PM
Thats a great idea! Thanks. Now I just need to add velocity in a certain direction...
Report Abuse
jelly134 is not online. jelly134
Joined: 25 Aug 2008
Total Posts: 1137
13 Dec 2012 01:51 PM
Yeah, that I am not too sure about, however I believe that if you add a .Unit onto the end of the lookVector, then add the following:

power = 10 --Change to the velocity you want in the direction they are heading
x = facingCFrame.X*power
y = facingCFrame.X*power
z = facingCFrame.X*power
BodyVelocity.velocity = Vector3.new(x,y,z) --Make sure to allocate BodyVelocity


I am not overly confident, but give it a try
Report Abuse
doneyes is not online. doneyes
Joined: 21 Mar 2008
Total Posts: 3466
13 Dec 2012 01:54 PM
I'm going to try it without the y because I don't want him to fly away. I'll try it out in a couple of minutes.
Report Abuse
jelly134 is not online. jelly134
Joined: 25 Aug 2008
Total Posts: 1137
13 Dec 2012 01:56 PM
oh okay, just switch y with 0.
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