|
| 05 Jun 2013 10:30 PM |
function fire(mouse) sw = Instance.new("Part", Workspace) sw.CFrame = game.Workspace.snowboarder199.Torso.CFrame * CFrame.new(0,10,0) * ? sw.Size = Vector3.new(1,1,5) sw.BrickColor = BrickColor.new("Bright red") sm = Instance.new("SpecialMesh", sw) sm.MeshId = "rbxasset://fonts/sword.mesh" bv = Instance.new("BodyVelocity", sw) bv.maxForce = Vector3.new(5000,5000,5000) bv.velocity = (sw.Position - mouse.Target).unit * 300 end)
So i want to set "sw"'s lookvector to where im pointing with the mouse but i dont know how i would do this, can anyone help me? |
|
|
| Report Abuse |
|
|
Geomaster
|
  |
| Joined: 05 Jul 2008 |
| Total Posts: 1480 |
|
|
| 05 Jun 2013 10:37 PM |
Where you set the CFrame..
sw.CFrame = CFrame.new(mouse.hit.p, game.Workspace.snowboarder199.Torso.CFrame.p) * CFrame.new(0,10,0) * ? |
|
|
| Report Abuse |
|
|
Geomaster
|
  |
| Joined: 05 Jul 2008 |
| Total Posts: 1480 |
|
|
| 05 Jun 2013 10:39 PM |
| Or instead of mouse.hit.p, you could try Humanoid.TargetPoint |
|
|
| Report Abuse |
|
|
Croze
|
  |
| Joined: 21 Mar 2010 |
| Total Posts: 449 |
|
|
| 05 Jun 2013 10:39 PM |
| (mouse.Hit.p - tool.Handle.CFrame.p) is the exact vector3 location of where a ray would theoretically hit the surface |
|
|
| Report Abuse |
|
|
|
| 05 Jun 2013 10:43 PM |
| ok thank you, and im using a hopperbin if it makes any difference. hopefully this works c: |
|
|
| Report Abuse |
|
|
Usering
|
  |
| Joined: 18 Aug 2012 |
| Total Posts: 10281 |
|
|
| 05 Jun 2013 11:16 PM |
Why are you putting a parenthesis after the end if it's not an anonymous function?
script.Parent.Activated:connect(function(mouse) sw = Instance.new("Part", Workspace) sw.CFrame = game.Workspace.snowboarder199.Torso.CFrame * CFrame.new(0,10,0) * ? sw.Size = Vector3.new(1,1,5) sw.BrickColor = BrickColor.new("Bright red") sm = Instance.new("SpecialMesh", sw) sm.MeshId = "rbxasset://fonts/sword.mesh" bv = Instance.new("BodyVelocity", sw) bv.maxForce = Vector3.new(5000,5000,5000) bv.velocity = (sw.Position - mouse.Target).unit * 300 end) |
|
|
| Report Abuse |
|
|