Help with some CFrame

Hello, so I’m trying to make some kind of ‘arms’ script but this is just for testing, that’s why it’s clietnsided, so basically, when you’re on first person it works fine but if you’re on first person the part starts spinining if you move mouse
Here you can see a gyaoz of the trouble:
https://gyazo.com/523ab96ba28e031c7f6035f9b8f83d67

local Arms = workspace.Arms
local cam = workspace.CurrentCamera
game:GetService('RunService').RenderStepped:Connect(function()
	if cam then
		if char:WaitForChild('Humanoid').Health > 0 then
			local IsFirstPerson = (cam.CFrame.p - char.Head.Position).Magnitude <= 1
	       if IsFirstPerson then
		    Arms:SetPrimaryPartCFrame(cam.CFrame * CFrame.new(0,0,-5))
			else
			Arms:SetPrimaryPartCFrame(char.HumanoidRootPart.CFrame * CFrame.new(0,0,-3) * CFrame.Angles(math.rad(mouse.Y),0,0):Inverse())
	end
		end
	end
end)

^ Code

Also quick question, what’s difference between object space and world space :confused:

grafik
Object Space
grafik
World Space

Object Space has it’s origin in the center of the part, world space in the origin of the world.

2 Likes

You could try removing the math.rad() function that is around the mouse.Y. Also I dont know if this makes any difference, but instead of mouse.Y, I would do mouse.Hit.p.Y

World space is always the same, it never changes. Let’s say the position 0,0,0 in world space is always the center of the map, but in object space, it is the center of the object. If you move something relative to object space, it translates around the object itself and ignore the axis on world space. Let’s say you have one part, left in object space wouldnt be left for a part with another rotation, but it would all be the same in world space. Hope this helps :slight_smile:

That didn’t helped much /:
https://gyazo.com/bdccfed70ffae4331456a5d769e560db
Now it’s kinda glitchy

I don’t really understand what you’re trying to achieve. Could you try to describe what you want to do? :happy1:

Like, I want the part moves according to your Mouse Y Position, but it’s not working really well lol

Sorry is still don’t understand :uhh: The part is following the mouse Y position…

Yea but its not doing as expected… i wqnt something like arms