I'm stumped on how to make my script disregard the Y axis on my player. (When I jump, it shouldn't follow me)
local part1 = game.Workspace.Part1 repeat wait() until workspace.Player local part2 = workspace.Player while true do part1.BodyGyro.cframe = CFrame.new(part1.Position,part2.Torso.Position) wait() end
I created a new CFrame for the direction of the BodyGyro. It's the same as the old CFrame, but I used part1.CFrame
's "Y" component in place of part2.Torso.CFrame
's.
part1.BodyGyro.cframe = CFrame.new(part1.Position, (CFrame.new(part2.Torso.CFrame.X, part1.CFrame.Y, part2.Torso.CFrame.Z)).p)
This is one of the many ways to do this. I hope this answers your question.
Edit:
Lol, I could've just as easily have done this.
part1.BodyGyro.cframe = CFrame.new(part1.Position, Vector3.new(part2.Torso.Position.X, part1.Position.Y, part2.Torso.Position.Z))