Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I use CFrame to rotate the mesh?

Asked by 5 years ago
Edited 5 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?


local rocketClone = Rocket:Clone() --game.Debris:AddItem(rocketClone, 30) rocketClone.BrickColor = player.TeamColor rocketClone.Touched:connect(function(hit) if hit and hit.Parent and hit.Parent ~= player.Character and hit.Parent ~= tool then rocketClone:Destroy() end end) spawn(function() wait(30) if rocketClone then rocketClone:Destroy() end end) -- Position the rocket clone and launch! local spawnPosition = (tool.Handle.CFrame * CFrame.new(2, 0, 0)).p rocketClone.CFrame = CFrame.new(spawnPosition, target)* CFrame.Angles(0 ,0 ,0) --NOTE: This must be done before assigning Parent rocketClone.Velocity = rocketClone.CFrame.lookVector * ROCKET_SPEED --NOTE: This should be done before assigning Parent rocketClone.Parent = game.Workspace -- Attach creator tags to the rocket early on local creatorTag = Instance.new('ObjectValue', rocketClone) creatorTag.Value = player creatorTag.Name = 'creator' --NOTE: Must be called 'creator' for website stats local iconTag = Instance.new('StringValue', creatorTag) iconTag.Value = tool.TextureId iconTag.Name = 'icon' delay(attackCooldown, function() canFire = true end) end end)
0
I have tried that... Maybe I haven't done it correctly. How would I go about using Orientation ExHydraboy 30 — 5y
0
orientation bad, vector3 is not meant for rotating. However @OP you clearly are giving an XY problem so your goal is not clear. User#24403 69 — 5y
0
WDYM ExHydraboy 30 — 5y
0
Flip the rocket around and have it go in the opposite direction. crywink 419 — 5y
View all comments (2 more)
0
It's funny that you mentioned that because I tried that but then I am unable to get the rocket to fly towards my look vector. ExHydraboy 30 — 5y
0
How would you do that ExHydraboy 30 — 5y

Answer this question