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: help please

Previous Thread :: Next Thread 
snowboarder199 is not online. snowboarder199
Joined: 15 Aug 2009
Total Posts: 2703
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 is not online. 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 is not online. 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 is not online. 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
snowboarder199 is not online. snowboarder199
Joined: 15 Aug 2009
Total Posts: 2703
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 is not online. 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
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