of     1   

ferano
#182948706Wednesday, February 03, 2016 9:58 PM GMT

So this isn't necessarily a gun script, it is a script that shoots out arrows from the weapon. It is not complete so some of the values are unused, however why do the arrows that the tool shoots come out slowly and why do they come out on weird angles? How do I fix this? Here is the script (it is a local script): Player = game.Players.LocalPlayer Gun = script.Parent --EDITABLES-- Ammo = 100 RechargeTime = 1 HeadDamage = 100 TorsoDamage = 50 LimbDamage = 30 ------------- mouse = Player:GetMouse() enabled = true function Shoot() if Ammo > 0 and enabled == true then Ammo = Ammo -1 wait(RechargeTime) -- INSERT ANIMATION CODE HERE local Bullet = Instance.new("Part", workspace) Gun.GripPos = Vector3.new(0, -0.35, 0.4) game.Debris: AddItem(Bullet, 3) Bullet.Shape = "Cylinder" Bullet.Size = Vector3.new(0.1,0.1,0.1) Bullet.TopSurface = "Smooth" Bullet.BottomSurface = "Smooth" Bullet.BrickColor = BrickColor.new("New yeller") Bullet.CanCollide = true Bullet.CFrame = Gun.Handle.CFrame Bullet.CFrame = CFrame.new(Bullet.Position, mouse.Hit.p) Bullet.Name = "Bullet" local BM = Instance.new("SpecialMesh", Bullet) BM.MeshType = ("FileMesh") BM.MeshId = ("http://www.roblox.com/asset/?id=15887356") BM.TextureId = ("http://www.roblox.com/asset/?id=15886781") BM.Scale = Vector3.new(-2, 2, -4.5) local v = Instance.new("BodyVelocity",Bullet) v.velocity = Bullet.CFrame.lookVector * 60 v.maxForce = Vector3.new (100,150,10) local c = Instance.new("BodyForce", Bullet) c.force = Vector3.new(0,150,0) local FireSound = Instance.new("Sound", Bullet) FireSound.SoundId = "http://www.roblox.com/asset/?id=16211030" local RP = math.random(60,80) RP = RP/10 FireSound.Pitch = RP local RV = math.random(70, 90) RV = RV/10 FireSound.Volume = RV FireSound:Play() game.Debris:AddItem(FireSound, 2) Gun.GripPos = Vector3.new (0, -0.6, 0.6) wait(RechargeTime) end end Gun.Activated:connect(Shoot)
ferano
#182949686Wednesday, February 03, 2016 10:15 PM GMT

Bump
ferano
#182949995Wednesday, February 03, 2016 10:20 PM GMT

Bump 2
ferano
#182950328Wednesday, February 03, 2016 10:25 PM GMT

Bump3
ferano
#182950943Wednesday, February 03, 2016 10:37 PM GMT

Bump4
Roblok1
#182954041Wednesday, February 03, 2016 11:31 PM GMT

first, CFrame the bolt to the handle. then CFrame it's direction like this: bolt.CFrame = bolt.CFrame*CFrame.new(bolt.CFrame, tool.Humanoid.Target) next insert a bodyVelocity and set its velocity like this: bodyVelocity.velocity = bolt.CFrame.lookvector*200 -- the speed is in SPS (studs per second) then it should work fine
Roblok1
#182954132Wednesday, February 03, 2016 11:32 PM GMT

oops, imn the first example, i meant to say this: Tool.Parent.Humanoid.Target
Roblok1
#182954279Wednesday, February 03, 2016 11:34 PM GMT

one other thing, for what you're doing can be done in a fraction of the code.
ferano
#182955927Wednesday, February 03, 2016 11:57 PM GMT

How can it be done in a fraction of the code?
ferano
#182956444Thursday, February 04, 2016 12:04 AM GMT

How can I make this more efficient but doing the same thing, but working better.

    of     1