|
| 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 |
|
|
|
| 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 |
|
|
|
| 13 Oct 2014 09:40 PM |
| I don't understand though. |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|