spawn(function()
while true do
wait()
if onwall == true then
local ray = Ray.new(Head.Position,Head.CFrame.LookVector * 2)
local hit, pos, normal = workspace:FindPartOnRay(ray,Char)
print(hit)
if hit == nil then
if lol == true then
lol = false
HRP.CFrame = CFrame.new(pos,Normal-Normal)
HRP.CFrame = CFrame.new(HRP.CFrame.p,Vector3.new(HRP.Position.X - Normal.x,HRP.Position.Y,HRP.Position.Z - Normal.z))
Hum.AutoRotate = false
end
end
end
end
end)
end
end)
I don’t exactly know how to rotate a player’s body. (I didn’t make any scripts that changed the player’s rotation) but you can try CFrame.Angles
Ah okay. Is it possible you could add a part that triggers an event to change it? Or maybe, you could check the player’s position relative to the cube and if it hits a certain spot then reorient the player?
local Player = game.Players.LocalPlayer
game:GetService("RunService").RenderStepped:Connect(function()
local Character = Player.Character
if Character ~= nil then
local hrp = Character.HumanoidRootPart
if hrp ~= nil then
hrp.CFrame = CFrame.new(hrp.Position, workspace.Part.Position)
end
end
end)
Try this? its not too good but maybe you can make it better
You could make the camera type attached to what your looking at. If you need it to rotate make invisible blocks and every (second as an example) a script makes your camera attach to one of the invisible blocks.
Exactly. Whenever you don’t detect a ray the character will turn 90 degrees. Also it probably doesn’t work because you have to put a ignore list. The way that you are using “Ray.new” is deprecated and I recommend using the “workspace:Raycast()” method. That way you can add the head to the ignore list and the ray won’t detect the head. Also please tell us what is printed in the output.