I would like the player’s orientation to align with the slope.
Adding -90 to the lookpart’s X and Y orientation to the player messes up the players orientation
I have tried messing with the lookpart’s X and Z orientations, but to no avail.
This is how the lookPart looks when not on a slope.
(The hinge shows where the front of the lookPart is)
This is how I want the lookPart to face when on a slope.
Instead, it faces 90 degrees to the left on the slope:
If anyone can help, it would be greatly appreciated.
NOTE: This script is made with the Juke's Towers of Hell 5.5 kit in mind.
local ts = game:GetService'TweenService'
return function ()
local plr = game.Players.LocalPlayer
local char = plr.Character
wait()
local torso = game.Players.LocalPlayer.Character:FindFirstChild("Torso")
local attach = Instance.new("Attachment", torso)
local vectorf1 = Instance.new("VectorForce", attach)
local vectorf2 = Instance.new("VectorForce", attach)
attach.Orientation = Vector3.new(0,0,90)
vectorf1.Force = Vector3.new(0,torso.AssemblyMass * workspace.Gravity,0)
vectorf1.Attachment0 = attach
vectorf1.RelativeTo = "World"
vectorf1.Enabled = false
vectorf1.Name = "GravityCounteract"
vectorf2.Force = Vector3.zero
vectorf2.Attachment0 = attach
vectorf2.RelativeTo = "Attachment0"
vectorf2.Enabled = false
local params = RaycastParams.new()
params.FilterType = Enum.RaycastFilterType.Include
params.FilterDescendantsInstances = {script.Parent}
local playerholder = Instance.new("Part", game.Players.LocalPlayer.Character)
playerholder.Size = Vector3.one
playerholder.Shape = "Ball"
playerholder.CFrame = torso.CFrame * CFrame.new(0, -2.5, 0)
playerholder.CanCollide = false
local phWeld = Instance.new("WeldConstraint", playerholder)
phWeld.Part0 = playerholder
phWeld.Part1 = torso
local lookPart = Instance.new("Part", game.Players.LocalPlayer.Character)
lookPart.Anchored = true
lookPart.CanCollide = false
lookPart.Size = Vector3.new(2,2,1)
lookPart.FrontSurface = "Hinge"
local ph2 = Instance.new("Part", char)
ph2.Size = Vector3.new(3, 0.4, 3)
local hrp = game.Players.LocalPlayer.Character:FindFirstChild("HumanoidRootPart")
local joint = hrp.RootJoint
spawn(function()
local rsLoop = game:GetService'RunService'.RenderStepped:Connect(function()
local result = workspace:Raycast(torso.Position, torso.CFrame.UpVector * -3, params)
if result then
vectorf1.Enabled = true
vectorf2.Enabled = true
lookPart.CFrame = CFrame.lookAt(result.Position, result.Position + result.Normal) * CFrame.Angles(math.rad(-90), math.rad(-90), 0)
vectorf2.Force = Vector3.new(0 -((workspace.Gravity * torso.AssemblyMass) * 2), 0)
end
end)
end)
end