You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
like the title says, i want the Arms follow my camera. -
What is the issue? Include screenshots / videos if possible!
issue is, i have no idea how. i already tried and all it did was fling me around the map, being armless, or sometimes not even having a torso. so i just reverted everything back to my original working script. which only affects the head and the Uppertorso.
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
already tried, and none of them worked, or is not supported to my version, this had me gotten so angry i even tried using gpt4, which didnt even work.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
local camera = workspace.CurrentCamera
local player = game.Players.LocalPlayer
local function setupCamera()
local character = player.Character or player.CharacterAdded:Wait()
local root = character:WaitForChild("HumanoidRootPart")
local neck = root.Parent.Head:WaitForChild("Neck", true)
local waist = root.Parent.UpperTorso:WaitForChild("Waist", true)
local yOffsetNeck = neck.C0.Y
local yOffsetWaist = waist.C0.Y
local Crouch = player:WaitForChild("Crouch")
local OnPhone = player:WaitForChild("OnPhone")
local CFNew, CFAng, asin, clamp = CFrame.new, CFrame.Angles, math.asin, math.clamp
local function clampAngles(x, y)
local maxXAngle = math.rad(45)
local maxYAngle = math.rad(45)
x = clamp(x, -maxXAngle, maxXAngle)
y = clamp(y, -maxYAngle, maxYAngle)
return x, y
end
local function onRenderStepped()
local cameraDirection = root.CFrame:toObjectSpace(camera.CFrame).lookVector
if neck then
local x, y = -asin(cameraDirection.x), asin(cameraDirection.y)
x, y = clampAngles(x, y)
neck.C0 = CFNew(0, yOffsetNeck, 0) * CFAng(0, x, 0) * CFAng(y, 0, 0)
end
if waist then
local x, y = -asin(cameraDirection.x), asin(cameraDirection.y)
x, y = clampAngles(x, y)
if Crouch.Value or OnPhone.Value then
waist.C0 = CFNew(0,0,0) * CFAng(0,0,0) * CFAng(0,0,0)
else
waist.C0 = CFNew(0, yOffsetWaist, 0) * CFAng(0, x, 0) * CFAng(y, 0, 0)
end
end
end
return onRenderStepped
end
local function onCharacterAdded(character)
local onRenderStepped = setupCamera()
game:GetService("RunService").RenderStepped:Connect(onRenderStepped)
end
player.CharacterAdded:Connect(onCharacterAdded)
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.