I'm trying to work on a somewhat anti-gravity script. And I'm trying to use CFrame to make it so that the player's torso is around 3 Studs away from the surface of the wall. Rn I'm using a part to test it and make sure things work out fine, however I can't get it to make the part go to the front/back side of the Wall when it's facing an angle. This is the current code I'm using:
w = game.Workspace.Wall
x = game.Workspace.Part
p = w.CFrame.p
bp = Instance.new("BodyPosition")
bp.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
bp.Position = p
bp.Parent = x
wait(2)
bp:remove()
However I want to make it work like this:
w = game.Workspace.Wall
x = game.Workspace.Part
p = w.CFrame*CFrame.new(0, 0, -3) -- Making it in front/behind the wall.
bp = Instance.new("BodyPosition")
bp.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
bp.Position = p
bp.Parent = x
wait(2)
bp:remove()
Any ways to do this?

1 comment
I know that, and I put in the first script CFrame.p, however it didn't work the way I wanted. Bur after messing with it I found a trick to do it right.