Hello all.
To put it simply, this camera script prevents a character rotation script from working despite it working perfectly otherwise.
local plr = game:GetService("Players").LocalPlayer local RS = game:GetService("RunService") local Camera = workspace.CurrentCamera Camera.CameraType = Enum.CameraType.Scriptable local zoom = 2000 --Distance between cam and character local fov = 1 --Field of view local function Isometric() local character = plr.Character or plr.CharacterAdded:wait() Camera.FieldOfView = fov if character and character:FindFirstChild("Head") then Camera.CFrame = CFrame.new(Vector3.new(character.Head.Position.X+zoom*0.8 ,character.Head.Position.Y+zoom/1.4 ,character.Head.Position.Z+zoom*1.2) ,character.Head.Position) end end RS:BindToRenderStep("Camera",Enum.RenderPriority.Camera.Value,Isometric)
I do not understand why it prevents this script from functioning properly.
--// Local Variables local Player = game:GetService("Players").LocalPlayer local Character = script.Parent local Humanoid = Character:WaitForChild("Humanoid") Humanoid.AutoRotate = false Humanoid:SetStateEnabled("RunningNoPhysics",false) local Mouse = Player:GetMouse() local Head = Character:WaitForChild("Head") local RootPart = Character:WaitForChild("HumanoidRootPart") --// Services local HB = game:GetService("RunService").Heartbeat --// Attachments local AttachmentPart = Instance.new("Part") AttachmentPart.Transparency = 0 AttachmentPart.Position = Vector3.new(0,75,0) AttachmentPart.CanCollide = false AttachmentPart.Anchored = true AttachmentPart.Shape = Enum.PartType.Ball AttachmentPart.Size = Vector3.new(1,1,1) AttachmentPart.FrontSurface = Enum.SurfaceType.Hinge AttachmentPart.Name = Player.Name.."AttachmentPart" AttachmentPart.Parent = Character local Attachment0 = Instance.new("Attachment") Attachment0.Name = "RA0" Attachment0.Parent = RootPart local Attachment1 = Instance.new("Attachment") Attachment1.Name = "RA1" Attachment1.Parent = RootPart local AlignOrientation = Instance.new("AlignOrientation") AlignOrientation.Attachment0 = Attachment0 AlignOrientation.Attachment1 = Attachment1 AlignOrientation.RigidityEnabled = true AlignOrientation.Parent = RootPart --// Code while HB:wait() and RootPart and AttachmentPart do local OriginPos = RootPart.Position local TargetPos = Mouse.Hit.p local TargetCF = CFrame.new(OriginPos,TargetPos) local x,y,z,R00,R01,R02,R10,R11,R12,R20,R21,R22 = TargetCF:components() local FinalCF = CFrame.Angles(0,math.atan2(R02,R22),0) AttachmentPart.CFrame = FinalCF end
Please, could someone lend a hand? :)
I apologize for having a surprising amount of code, I believed it was a necessity to include everything and will gladly repost with simplified code if needed.
EDIT: To elaborate, while the player rotation script actually works, the character can only shake while being forced to look in one direction.