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 » Scripters
Home Search
 

Re: arrow script

Previous Thread :: Next Thread 
Alimegacorn is not online. Alimegacorn
Joined: 24 May 2013
Total Posts: 899
02 Jul 2016 05:33 PM
im trying to make a arrow be shot towards the mouse's position, but its flying everywhere

script:

local tool = script.Parent
local player = game:GetService("Players").LocalPlayer
local mouse = player:GetMouse()

tool.Equipped:connect(function(mouse)

mouse.Button1Down:connect(function()
local Arrow = Instance.new("Part", game.Workspace)
Arrow.Size = Vector3.new(4, 1, 1)
Arrow.Position = player.Character.Torso.Position + Vector3.new(0, 0, -5)
Arrow.CanCollide = false
local ArrowMesh = Instance.new("SpecialMesh", Arrow)
ArrowMesh.MeshType = Enum.MeshType.FileMesh
ArrowMesh.MeshId = "http://www.roblox.com/asset/?id=15887356"
ArrowMesh.TextureId = "http://www.roblox.com/asset/?id=15886781"
local Thrust = Instance.new("BodyThrust", Arrow)
Thrust.force = Vector3.new(0, 0, 40000)
Thrust.location = mouse.Hit.p
end)
end)

no errors btw
Report Abuse
Alimegacorn is not online. Alimegacorn
Joined: 24 May 2013
Total Posts: 899
03 Jul 2016 11:00 AM
bump
Report Abuse
Alimegacorn is not online. Alimegacorn
Joined: 24 May 2013
Total Posts: 899
03 Jul 2016 11:42 AM
b
Report Abuse
AxonMega is not online. AxonMega
Joined: 29 Aug 2014
Total Posts: 2403
03 Jul 2016 12:18 PM
I don't think you understand what the location of a BodyThrust does. Look it up here: http://wiki.roblox.com/index.php?title=API:Class/BodyThrust

Also, try:

local force = Instance.new("BodyForce", Arrow)
local direction = (mouse.Hit.p - Arrow.Position).unit*40
force.Force = direction + Vector3.new(0, Arrow:GetMass()*workspace.Gravity, 0)
Report Abuse
Alimegacorn is not online. Alimegacorn
Joined: 24 May 2013
Total Posts: 899
03 Jul 2016 12:25 PM
yea, i never really understood all of the bodymovers

ill give your script a shot

thanks
Report Abuse
AxonMega is not online. AxonMega
Joined: 29 Aug 2014
Total Posts: 2403
03 Jul 2016 12:44 PM
Welcome.
Report Abuse
Soybeen is online. Soybeen
Joined: 17 Feb 2010
Total Posts: 21462
03 Jul 2016 12:51 PM
If you just want it to travel to the cursor's position in the world, you could get away with using CFrame if you don't want to account for drop


Report Abuse
Soybeen is online. Soybeen
Joined: 17 Feb 2010
Total Posts: 21462
03 Jul 2016 12:54 PM
Even then you could fake gravity by exponentially increasing the drop rate

9.8 meters per second squared


Report Abuse
Isostae is not online. Isostae
Joined: 14 Sep 2014
Total Posts: 17706
03 Jul 2016 12:55 PM
"Thrust.force = Vector3.new(0, 0, 40000)"


that would be the problem.


- Isosta
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
03 Jul 2016 12:57 PM
No, that wouldn't be the problem.
That would be correct, if he was using a BodyGyro and not setting Location.
In fact, that would probably be better than a BodyForce because then at least it would angle towards the target.


Sort of.

I mean, personally I would make it be oriented along its trajectory, because who has ever even heard of an arrow falling and still pointing upwards?
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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