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: Torso Position

Previous Thread :: Next Thread 
ScriptGuilder is not online. ScriptGuilder
Joined: 07 Aug 2014
Total Posts: 848
13 Oct 2014 09:32 PM
How would I make this shoot the blocks whichever way my Torso is facing

Player = game.Players.LocalPlayer
Char = Player.Character
Torso = Char.Torso
Mouse = Player:GetMouse()
Mouse.KeyDown:connect(function(key)
if (key == 'v') then
for i = 1, 100,3 do
earth = Instance.new('Part', game.Workspace)
earth.Size = Vector3.new(math.random(4,6),math.random(4,6),math.random(4,6))
earth.Anchored = true
earth.CFrame = CFrame.new(Torso.Position.x,5,Torso.Position.z) * CFrame.new(0,0,i) * CFrame.Angles(math.random(),math.random(),math.random())
end
end
end)
Report Abuse
devUUIdiot is not online. devUUIdiot
Joined: 18 Dec 2013
Total Posts: 122
13 Oct 2014 09:33 PM
set the velocity to the direction of the torso multiplied by the speed you want.

earth.Velocity = yourTorso/Head/etc.CFrame.lookVector * 500
Report Abuse
ScriptGuilder is not online. ScriptGuilder
Joined: 07 Aug 2014
Total Posts: 848
13 Oct 2014 09:40 PM
I don't understand though.
Report Abuse
devUUIdiot is not online. devUUIdiot
Joined: 18 Dec 2013
Total Posts: 122
13 Oct 2014 09:41 PM
The lookVector is a property of CFrame that returns a Vector3 of the direction (a unit vector, meaning a vector with a length of 1, aka x^2 + y^2 + z^2 == 1) and the "forward" direction is the relative -z axis.
Report Abuse
devUUIdiot is not online. devUUIdiot
Joined: 18 Dec 2013
Total Posts: 122
13 Oct 2014 09:43 PM
And * 500 to set the speed. Since the lookVector returns the vector with a length of 1, it means it's going to go 1 stud/sec and multiply the vector by 500, it goes 500 studs/sec (which is way to fast and you should probably use 100 since if you go to fast, Roblox won't pick up the collision
Report Abuse
ScriptGuilder is not online. ScriptGuilder
Joined: 07 Aug 2014
Total Posts: 848
13 Oct 2014 09:53 PM
How would I make it work with the script?
and can you explain which each thing does?


srry, l0l
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