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: Velocity Help?

Previous Thread :: Next Thread 
noobkiller878 is not online. noobkiller878
Joined: 22 Dec 2008
Total Posts: 1465
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
noobkiller878 is not online. noobkiller878
Joined: 22 Dec 2008
Total Posts: 1465
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
noobkiller878 is not online. noobkiller878
Joined: 22 Dec 2008
Total Posts: 1465
23 Oct 2013 04:59 PM
Never mind. I found my utter failure. Fixed it and gained common sense.
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