How do I use CFrame to rotate the mesh?
Asked by
6 years ago Edited 6 years ago
The script functions the link leads to a gif containing the problem.
https://s2.gifyu.com/images/Kapture-2019-02-26-at-16.39.00.gif
NOTE: The projectile did not fire in the wrong direction, I simply slowed the projectile's speed so you could see the projectile mid air. The Mesh attached to the model is backwards. I cannot rotate it even though I used the CFrame.Angles function. While using the CFrame, the projectile fires in the correct direction, but the mesh remains facing facing the wrong direction. How do I use CFrame to rotate?
01 | local rocketClone = Rocket:Clone() |
03 | rocketClone.BrickColor = player.TeamColor |
04 | rocketClone.Touched:connect( function (hit) |
05 | if hit and hit.Parent and hit.Parent ~ = player.Character and hit.Parent ~ = tool then |
12 | if rocketClone then rocketClone:Destroy() end |
16 | local spawnPosition = (tool.Handle.CFrame * CFrame.new( 2 , 0 , 0 )).p |
17 | rocketClone.CFrame = CFrame.new(spawnPosition, target)* CFrame.Angles( 0 , 0 , 0 ) |
18 | rocketClone.Velocity = rocketClone.CFrame.lookVector * ROCKET_SPEED |
19 | rocketClone.Parent = game.Workspace |
22 | local creatorTag = Instance.new( 'ObjectValue' , rocketClone) |
23 | creatorTag.Value = player |
24 | creatorTag.Name = 'creator' |
25 | local iconTag = Instance.new( 'StringValue' , creatorTag) |
26 | iconTag.Value = tool.TextureId |
29 | delay(attackCooldown, function () |