Rotational Error, rotates completely wrong. Any help?
I have a rotational error, and it hasn't fixed.
02 | local soldier = script.Parent.Parent.Parent [ "" ] |
06 | for _,bloons in pairs (workspace.Bloons:GetChildren()) do |
08 | local mag = (script.Parent.Parent.Parent.Parent.Position-bloons.Position).magnitude |
12 | soldier:SetPrimaryPartCFrame(CFrame.new(soldier.Torso.Position, |
13 | Vector 3. new(bloons.Torso.Position.X, soldier.Torso.Position.Y, |
14 | bloons.Torso.Position.Z))*CFrame.Angles( 0 ,-math.pi/ 3 , 0 )) |
18 | if closest and enabled then script.Parent.Parent.Parent.Parent.CFrame = CFrame.new(script.Parent.Parent.Parent.Parent.Position,closest.Position) |
21 | local x = Instance.new( "Part" ) |
24 | x.BrickColor = BrickColor.new( 255 , 176 , 0 ) |
25 | x.Size = Vector 3. new( 1 , 1 , 1 ) |
26 | x.TopSurface = "Smooth" |
27 | x.BottomSurface = "Smooth" |
32 | x.CFrame = script.Parent.CFrame*CFrame.new( 0 , 0 , 0 ) |
33 | y = Instance.new( "BodyVelocity" ) |
34 | y.maxForce = Vector 3. new( math.huge , math.huge , math.huge ) |
35 | y.velocity = script.Parent.Parent.Parent.Parent.CFrame.lookVector* 100 * 9 |
36 | x.Parent = game.Workspace |
39 | x.Touched:connect( function (hit) |
40 | if hit.Name = = "Red Bloon" then |
41 | if closest.hp.Value ~ = 0 then |
42 | print (closest.hp.Value) |
43 | closest.hp.Value = closest.hp.Value - 1 |
52 | if dogfrog = = true then |
53 | local shot = Instance.new( "Part" ) |
54 | shot.Shape = "Cylinder" |
55 | shot.CFrame = script.Parent.CFrame*CFrame.new( 0 , 0 , 0 ) |
56 | shot.BrickColor = BrickColor.new( 255 , 176 , 0 ) |
57 | shot.Size = Vector 3. new( 0.05 , 0.59 , 0.9 ) |
58 | shot.Material = "Neon" |
59 | shot.Transparency = . 3 |
60 | shot.Parent = script.Parent.Parent |
This is supposed to rotate towards 'bloons'. Any help?