|
| 23 Oct 2013 04:47 PM |
My firing script isn't working as I intended. I remixed what I could and hoped it works but I don't understand why it doesn't. I set individual prints to help find where the problem and it stops at Set BodyVelocity, which I will mark. Of course I know nothing of mouse values so I kind of got what I could and hoped for the best, any fix for that line?
script.Parent.Selected:connect(function(mouse) mouse.Move:connect(function() if script.Parent.TankVal.Value==1 then wait(0.1) gyro=script.Parent.Vehicle.Value.Pointer.BodyGyro gyro.cframe = CFrame.new(gyro.Parent.Position,mouse.Hit.p) end end) mouse.Button1Down:connect(function() if script.Parent.TankVal.Value==1 then print('is a tank') if script.Parent.Reload.Value==0 then print('is reloaded') script.Parent.Reload.Value=1 GunNum=script.Parent.Vehicle.Value.Gun1 coroutine.resume(coroutine.create(function() print('created routine') v=script.Parent.Vehicle.Value v1=v.Bullet:Clone() print('Cloned') vel=Instance.new("BodyVelocity") vel.Parent=v1.Tip print('Set BodyVelocity') v1.Tip.PointLight.Enabled=true ------vel.velocity=CFrame.new(gyro.Parent.Position,mouse.Hit.p)*500 print('Set Velocity') v1.Tip.Transparency=0 v1.Shaft.Transparency=0 v1.Parent=v print("Created bullet") coroutine.resume(coroutine.create(function() GunNum.Smoke.Enabled=true wait(1) GunNum.Smoke.Enabled=false wait(0.05) end)) coroutine.resume(coroutine.create(function() for lightA = 0, 1, 0.1 do GunNum.PointLight.Enabled=true GunNum.PointLight.Brightness=lightA wait(0.025) end for lightB = 1, 0, -0.1 do GunNum.PointLight.Enabled=true GunNum.PointLight.Brightness=lightB wait(0.025) end end)) coroutine.resume(coroutine.create(function() GunNum.Fire.Enabled=true wait(1) GunNum.Fire.Enabled=false end)) wait(script.Parent.ReloadTime.Value) script.Parent.Reload.Value=0 end)) end end end) end)
|
|
|
| Report Abuse |
|
|
| 23 Oct 2013 04:51 PM |
| I thought I fixed it after I post in, and changed gyro in the parenthesis to vel, but of course that isn't the answer. I know everything that is equal to vel.Velocity is wrong and I don't understand the concept of it. I'm just trying. My intent was to get the bullet to fire in the direction of my mouse instead of straight out of the cannon which is severely inaccurate. Help? |
|
|
| Report Abuse |
|
|
| 23 Oct 2013 04:59 PM |
| Never mind. I found my utter failure. Fixed it and gained common sense. |
|
|
| Report Abuse |
|