Cannon ball not changing firing position? [FIXED]
Asked by
7 years ago Edited 7 years ago
01 | c = script.Parent.click |
05 | pp = script.Parent.Barrel.Position |
08 | script.Parent.click.ClickDetector.MouseClick:connect( function () |
09 | if debounce = = true then c.BrickColor = BrickColor.new( "Really red" ) |
12 | b = Instance.new( "Part" , game.Workspace) |
13 | f = Instance.new( "BodyThrust" , b) |
14 | fire = Instance.new( "Fire" , b) |
16 | b.BrickColor = BrickColor.new( "Really black" ) |
18 | b.Size = Vector 3. new( 2 , 2 , 2 ) |
19 | b.Position = Vector 3. new(pp.X , pp.Y , pp.Z + 2.5 ) |
20 | f.Force = Vector 3. new( 0 , 0 , 10000 ) |
22 | b.Touched:connect( function (hit) |
23 | if hit.Parent then if hit.Parent.Name = = barrel then |
27 | e = Instance.new( "Explosion" , b) |
28 | e.Position = b.Position |
37 | c.BrickColor = BrickColor.new( "Bright green" ) |
It fires where the cannon was when the game first loaded and not where the cannon is at the moment. I tried to use a while true do loop for the position but it didnt run because it was doing the loop. - Thanks