|
| 14 Jun 2015 07:59 AM |
The problem in my script is the bullet won't fly forward. (It is a gun script) So can someone please correct my script?
---------------------------------------------------------- ------------ Made by killaman333 ------------- ---------------------------------------------------------
function click(Guy) ---------------------------------------------------------- ------------------ VAIRIABLES ------------------- --------------------------------------------------------- local con = script.Parent.Configuration local Bullet_Life = con.Bullet_Life.Value local damage = con.Damage.Value local Fire_Rate = con.Fire_Rate.Value -- Do not change number to Uneven value such as -- (0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.6 or so on *If you proceed to disreguard these intruction, The script will break*) local Speed = con.Speed.Value local R_time = con.Reload_Time.Value local Total_Ammo = con.Total_Ammo local Bullet_Position = script.Parent.BulletPOS.Position local mesh = Instance.new("SpecialMesh") local bullet = Instance.new("Part") ---------------------------------------------------------- ----------------- MAIN SCRIPT ------------------ ---------------------------------------------------------- bullet.Parent = script.Parent bullet.Name = ("_bullet_") mesh.Parent = script.Parent._bullet_ mesh.Scale = Vector3.new(0.5, 0.5, 0.5) mesh.MeshType = ("Sphere") -- Use ancestery changed method bullet.CFrame = CFrame.new(Bullet_Position) local CURRENT_Z = bullet.Velocity.Z
for timer = 0, Bullet_Life do bullet.Velocity = (Vector3.new(0, 0, CURRENT_Z + 1)) wait(1) end
for time = Fire_Rate, 0, -0.1 do script.Disabled = true wait(0.1) end script.Disabled = false bullet:Destroy()
end script.Parent.Activated:connect(click)
i have'nt finished yet but i'm having trouble with the shooting |
|
|
| Report Abuse |
|
|
| 14 Jun 2015 08:06 AM |
Setting the velocity of an part doesn't work to well. (Always wondered why...)
Use a BodyMover like BodyVelocity instead. |
|
|
| Report Abuse |
|
|
| 14 Jun 2015 08:07 AM |
also, I advise against doing anything like this:
script.Disabled = true |
|
|
| Report Abuse |
|
|
| 14 Jun 2015 08:07 AM |
@builder
this works fine
part.Velocity = Mouse.Hit.lookVector*Power |
|
|
| Report Abuse |
|
|
| 14 Jun 2015 08:51 AM |
| Does it? hmm... If I remember correctly that always fell down like a brick when I tried that. |
|
|
| Report Abuse |
|