For some reason, the part and player moves roughly when Humanoid.CameraOffset’s value is set to 0, 0.25,-1.2
this is what it looks like when value is set to 0, 0, 0 (it is smooth and not rough)
make sure this script is placed into startercharacterscripts
local Player = game:GetService("Players").LocalPlayer
local Humanoid = Player.Character:WaitForChild("Humanoid")
Humanoid.CameraOffset = Vector3.new(0, 0.25,-1.2)
local character = Player.Character or Player.CharacterAdded:Wait()
local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
local statsPart = Instance.new("Part")
statsPart.Size = Vector3.new(2, 2, 0.49)
statsPart.Anchored = true
statsPart.CanCollide = false
statsPart.Transparency = 0.5
statsPart.Name = "stats"
statsPart.Parent = workspace
local statsOffset = CFrame.new(0, -0.9, -0.4) * CFrame.Angles(math.rad(-45), math.rad(180), 0)
local shakeAmplitude = 0.1
local shakeSpeed = 2
local RunService = game:GetService("RunService")
local connection
connection = RunService.RenderStepped:Connect(function(deltaTime)
if humanoidRootPart and humanoidRootPart.Parent then
local time = tick() * shakeSpeed
local shakeX = math.sin(time) * shakeAmplitude
local shakeY = math.cos(time) * shakeAmplitude
local shakingOffset = CFrame.new(shakeX, shakeY, 0)
local look = workspace.CurrentCamera.CFrame.lookVector
humanoidRootPart.CFrame = CFrame.new(Vector3.new(0,0,0), Vector3.new(look.x, 0, look.z)) + humanoidRootPart.Position
statsPart.CFrame = humanoidRootPart.CFrame * statsOffset * shakingOffset
else
connection:Disconnect()
end
end)
can someone plz help make it smooth while Humanoid.CameraOffset = Vector3.new(0, 0.25,-1.2)