thetacah
|
  |
| Joined: 18 Jan 2013 |
| Total Posts: 16026 |
|
|
| 15 Dec 2013 04:23 PM |
It starts shooting from the baseplate when it's suppose to come from the gun/snowball..
local Ammo = 25 local BulletDamage = 5 local Player = game.Players.LocalPlayer local mouse = Player:GetMouse() local Gun = game.StarterPack.Snowball
function Damage(Part) if Part.Parent:FindFirstChild("Humanoid") and Part.Parent.Name ~= Player.Name then Part.Parent.Humanoid:TakeDamage(BulletDamage) Bullet:Destroy() end end
function shoot() if Ammo <= 25 then wait() Bullet = Instance.new("Part", workspace) Bullet.Touched:connect(Damage) Bullet.Shape = "Ball" Bullet.Size = Vector3.new(0.1, 0.1, 0.1) Bullet.TopSurface = "Smooth" Bullet.BottomSurface = "Smooth" Bullet.BrickColor = BrickColor.new("Bright red") Bullet.CanCollide = true Bullet.CFrame = Gun.Handle.CFrame Bullet.CFrame = CFrame.new(Bullet.Position,mouse.Hit.p) v = Instance.new("BodyVelocity", Bullet) v.velocity = Bullet.CFrame.lookVector *90 v.maxForce = Vector3.new(math.huge, math.huge, math.huge) game.Debris:AddItem(Bullet, 1)
end end script.Parent.Parent.Activated:connect(shoot) |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 15 Dec 2013 04:26 PM |
replace "Bullet.CFrame = Gun.Handle.CFrame Bullet.CFrame = CFrame.new(Bullet.Position,mouse.Hit.p)"
with "Bullet.CFrame = CFrame.new(Gun.Handle.Position, mouse.Hit.P)"
And replace "v = Instance.new("BodyVelocity", Bullet) v.velocity = Bullet.CFrame.lookVector *90 v.maxForce = Vector3.new(math.huge, math.huge, math.huge)"
with "Bullet.Velocity = mouse.Hit.p.unit * 90 v = Instance.new("BodyForce", Bullet) v.Force = Vector3.new(0, Bullet:GetMass() * 196.2, 0)" |
|
|
| Report Abuse |
|
|
thetacah
|
  |
| Joined: 18 Jan 2013 |
| Total Posts: 16026 |
|
| |
|
thetacah
|
  |
| Joined: 18 Jan 2013 |
| Total Posts: 16026 |
|
|
| 15 Dec 2013 04:32 PM |
| @Cnt, they don't disappear now, they, they don't shoot from my gun... |
|
|
| Report Abuse |
|
|
thetacah
|
  |
| Joined: 18 Jan 2013 |
| Total Posts: 16026 |
|
|
| 15 Dec 2013 04:34 PM |
| Ouput is : 17:34:18.288 - Force is not a valid member of BodyForce |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 15 Dec 2013 04:35 PM |
(Gun.Handle.Position + (Gun.Handle.CFrame.lookVector*5)) For the position part of CF |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 15 Dec 2013 04:35 PM |
| oops, try .force, so v.force = ... |
|
|
| Report Abuse |
|
|
thetacah
|
  |
| Joined: 18 Jan 2013 |
| Total Posts: 16026 |
|
|
| 15 Dec 2013 04:43 PM |
This is what I have so far and it still starts shooting from the base...:
local Ammo = 25 local BulletDamage = 5 local Player = game.Players.LocalPlayer local mouse = Player:GetMouse() local Gun = game.StarterPack.Snowball
function Damage(Part) if Part.Parent:FindFirstChild("Humanoid") and Part.Parent.Name ~= Player.Name then Part.Parent.Humanoid:TakeDamage(BulletDamage) Bullet:Destroy() end end
function shoot() if Ammo <= 25 then wait() Bullet = Instance.new("Part", workspace) Bullet.Touched:connect(Damage) Bullet.Shape = "Ball" Bullet.Size = Vector3.new(0.1, 0.1, 0.1) Bullet.TopSurface = "Smooth" Bullet.BottomSurface = "Smooth" Bullet.BrickColor = BrickColor.new("Bright red") Bullet.CanCollide = true Bullet.CFrame = CFrame.new(Gun.Handle.Position + (Gun.Handle.CFrame.lookVector*5)) Bullet.Velocity = mouse.Hit.p.unit * 90 v = Instance.new("BodyForce", Bullet) v.force = Vector3.new(0, Bullet:GetMass() * 196.2, 0) game.Debris:AddItem(Bullet, 1)
end end script.Parent.Parent.Activated:connect(shoot) |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 15 Dec 2013 04:46 PM |
| It's in a localscript and right? |
|
|
| Report Abuse |
|
|
thetacah
|
  |
| Joined: 18 Jan 2013 |
| Total Posts: 16026 |
|
|
| 15 Dec 2013 04:49 PM |
| Yes, it's in a localscript... |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 15 Dec 2013 04:51 PM |
This is your problem: "local Gun = game.StarterPack.Snowball" You probably wanted "local Gun = script.Parent" |
|
|
| Report Abuse |
|
|
thetacah
|
  |
| Joined: 18 Jan 2013 |
| Total Posts: 16026 |
|
|
| 15 Dec 2013 04:57 PM |
| Ok, comes from me now, but doesn't go to where my mouse goes. |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 15 Dec 2013 05:10 PM |
| What do you currently have? |
|
|
| Report Abuse |
|
|
thetacah
|
  |
| Joined: 18 Jan 2013 |
| Total Posts: 16026 |
|
|
| 15 Dec 2013 05:37 PM |
local Ammo = 25 local BulletDamage = 5 local Player = game.Players.LocalPlayer local mouse = Player:GetMouse() local Gun = script.Parent.Parent
function Damage(Part) if Part.Parent:FindFirstChild("Humanoid") and Part.Parent.Name ~= Player.Name then Part.Parent.Humanoid:TakeDamage(BulletDamage) Bullet:Destroy() end end
function shoot() if Ammo <= 25 then wait() Bullet = Instance.new("Part", workspace) Bullet.Touched:connect(Damage) Bullet.Shape = "Ball" Bullet.Size = Vector3.new(0.1, 0.1, 0.1) Bullet.TopSurface = "Smooth" Bullet.BottomSurface = "Smooth" Bullet.BrickColor = BrickColor.new("Bright red") Bullet.CanCollide = true Bullet.CFrame = CFrame.new(Gun.Handle.Position + (Gun.Handle.CFrame.lookVector*5)) Bullet.Velocity = mouse.Hit.p.unit * 90 v = Instance.new("BodyForce", Bullet) v.force = Vector3.new(0, Bullet:GetMass() * 196.2, 0) game.Debris:AddItem(Bullet, 1)
end end script.Parent.Parent.Activated:connect(shoot) |
|
|
| Report Abuse |
|
|