Currently I’m working on a weapon tool, when it’s being equipped, the arms will follow the mouse.
local followmouse = false
local RS = CFrame.new( 1, 0.5, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0)
local LS = CFrame.new( -1, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
ShotgunTool.Equipped:Connect(function()
..
followmouse = true
..
end)
ShotgunTool.Unequipped:Connect(function()
..
followmouse = false
..
end)
game:GetService("RunService").RenderStepped:Connect(function()
if followmouse == true then
char.Torso["Right Shoulder"].C0 = CFrame.new(1,0.5,0) * CFrame.Angles(-math.asin((mouse.Origin.p - mouse.Hit.p).unit.y),1.55,0)
char.Torso["Left Shoulder"].C0 = CFrame.new(-1,0.5,0) * CFrame.Angles(-math.asin((mouse.Origin.p - mouse.Hit.p).unit.y),-1.55,0)
elseif followmouse == false then
char.Torso["Right Shoulder"].C0 = RS
char.Torso["Left Shoulder"].C0 = LS
end
end)
However, this doesn’t work when there is 2 weapon in backpack, it only works for 1 tool, another one doesn’t work.
They both have the same LocalScript inside the tool:
https://gyazo.com/2518c1ab84c93d1beb50355801c54744
How do I resolve this? Thanks