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

The cylinder's front is strange?

Asked by 5 years ago

I have a kamehameha script and I'm trying to make it so it faces the mouse but I realized roblox says the long part of the cylinder is the front so I need it to rotate itself 90º but idk how.

        launch = Instance.new('Part', ctr)
        launch.Shape = 'Cylinder'
        launch.Size = Vector3.new(75, 5, 5)
        launch.CFrame = ctr:FindFirstChild('Torso').CFrame * CFrame.new(0, 0, -37.5)
        launch.BrickColor = BrickColor.new('Toothpaste')
        launch.Material = 'Neon'
        launch.CanCollide = false
        launch.Anchored = true
        launch.CFrame = CFrame.new(launch.CFrame.Position, m.Hit.Position)

sorry if it's indented. I was too lazy to remove the indentation from the script.

0
yea ReaperMr 0 — 4y

1 answer

Log in to vote
1
Answered by 5 years ago
Edited 5 years ago

just make a offset to rotate it 90º using CFrame.Angles(), also use local variables and the parent argument of Instance.new() is deprecated; set the parent last.

launch.CFrame = CFrame.new(launch.CFrame.Position, m.Hit.Position) * CFrame.Angles(0,math.rad(90),0) -- or you could divide pi by 2
0
thx HappyTimIsHim 652 — 5y
Ad

Answer this question