WindowUser2
(TemperedGlass)
November 13, 2024, 7:03pm
#1
Hello, I have a problem where i start flying around when i start aiming, and getting flinged when i do stop aiming. Here’s my code:
RunService:BindToRenderStep("CamAimPos", 1, function()
local camCF, torsoCF
local rightShoulder = Torso:WaitForChild("Right Shoulder")
local leftShoulder = Torso:WaitForChild("Left Shoulder")
local lerpSpeed = 0.25
camCF = Camera.CFrame
torsoCF = Torso.CFrame
local rightArmPos = camCF * CFrame.new(1, -1, -0.5)
rightArmPos = torsoCF:ToObjectSpace(rightArmPos) * CFrame.Angles(0, math.pi / 2, 0)
rightShoulder.C0 = rightShoulder.C0:Lerp(rightArmPos, lerpSpeed)
local leftArmPos = camCF * CFrame.new(-1, -1, -0.5)
leftArmPos = torsoCF:ToObjectSpace(leftArmPos) * CFrame.Angles(0, -math.pi / 2, 0)
leftShoulder.C0 = leftShoulder.C0:Lerp(leftArmPos, lerpSpeed)
if Tool and Tool:FindFirstChild("Handle") then
Tool.Handle.CFrame = camCF * CFrame.new(0, 0, -1)
end
end)
2 Likes
WindowUser2
(TemperedGlass)
November 13, 2024, 7:30pm
#2
If no one else knows, I will also add this line of code that was added before the bind:
Camera.CameraType = Enum.CameraType.Follow
Camera.CameraSubject = Tool.AimPos
1 Like
Hzodx
(Hzodx)
November 13, 2024, 8:19pm
#3
Make sure your tool is not collideable
1 Like
Scottifly
(Scottifly)
November 13, 2024, 8:20pm
#4
Do you have a tool in your hands? All tool parts need to be Massless true otherwise the mass interferes with player physics.
1 Like
WindowUser2
(TemperedGlass)
November 13, 2024, 8:37pm
#5
tried this and didnt work, well i could just use animations but its really hard and i have to adjust it so much
^^^ do this, your tool is probably colliding with the player character model
Scottifly
(Scottifly)
November 13, 2024, 10:40pm
#7
There are plenty of posts on the forums about ‘aiming gun to mouse’ or ‘point arm to mouse’.
Maybe search around in a few of those for some hints on what to do.
WindowUser2
(TemperedGlass)
November 14, 2024, 8:58am
#8
i also did that but didnt even work.