RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"it doesnt tilt the camera"
-- server script local module = {} local CC = workspace.CurrentCamera local UIS = game:GetService("UserInputService") local RS = game:GetService("RunService") local ion = 0 local know = 0 local what = 0 local to = 0 local call = 0 local these = nil function mFS(transp) if transp.UserInputType == Enum.UserInputType.MouseMovement then if char then ion = ion - transp.Delta.X * 0.4 know = math.clamp(know - transp.Delta.Y * 0.4, -80, 80) local mouseLoc = UIS:GetMouseLocation() char:SetPrimaryPartCFrame(CFrame.new(char.PrimaryPart.Position, char.PrimaryPart.Position CC:ScreenPointToRay(mouseLoc.X, mouseLoc.Y).Direction * Vector3.new(1, 0, 1))) end end end function chrTransp(transparencyvalue) local func, humandescd, humanwentthrough1 = pairs(char:GetDescendants()) while true do local humanwentthrough2, bodyp = func(humandescd, humanwentthrough1) if humanwentthrough2 then else break end humanwentrough1 = humanwentthrough2 if bodyp.Name ~= "HumanoidRootPart" then if bodyp:IsA("MeshPart") then bodyp.Transparency = transparencyvalue end end end end function lerp(value1, value2, value3) return value1 (value2 - value1) * value3 end function module.FirstPerson() UIS.MouseIconEnabled = false game.Players.LocalPlayer.CameraMode = Enum.CameraMode.LockFirstPerson CC.FieldOfView = 60 if not UIS.TouchEnabled and not UIS.GamepadEnabled then RS:BindToRenderStep("fp",Enum.RenderPriority.Camera.Value, function(p8) UIS.MouseBehavior = Enum.MouseBehavior.LockCenter CC.CameraType = Enum.CameraType.Scriptable chrTransp(1) if char and char:FindFirstChild("Humanoid") and char:FindFirstChild("HumanoidRootPart") then to = lerp(to, math.clamp(UIS:GetMouseDelta().X, -1, 1), 5 * p8) if char.Humanoid:GetState() == Enum.HumanoidStateType.Jumping or char.Humanoid:GetState() == Enum.HumanoidStateType.Freefall then CC.CFrame = CC.CFrame:Lerp(CFrame.new(char:GetPrimaryPartCFrame().Position Vector3.new(0, 1.5, 0)) * CFrame.fromAxisAngle(Vector3.new(0, 1, 0), math.rad(ion)) * CFrame.fromAxisAngle(Vector3.new(1, 0, 0), math.rad(know)), 0.35) * CFrame.Angles(0, 0, math.rad(to)) * (CFrame.Angles(0, 0, -what) * CFrame.Angles(0, 0, 0)) end end end) these = UIS.InputChanged:Connect(mFS) end end return module