So I made a gun and I made a script to make it so the arms and gun of the player move up and down with the Y position of the mouse but this is what happens:
this is my client script:
local player = game.Players.LocalPlayer
player.CharacterAdded:Connect(
function(Character)
local mouse = player:GetMouse()
local tool = script.Parent
local Torso = Character:WaitForChild("HumanoidRootPart")
local Motor = Torso.Motor6D
tool.Equipped:Connect(
function()
game.ReplicatedStorage.MoveArms:FireServer(Motor, tool.Handle)
Torso.Motor6D.C0 =
Torso.Motor6D.C0 * CFrame.Angles(math.asin((mouse.Hit.p - mouse.Origin.p).unit.y), 0, 0)
end
)
end
)
and this is my server script:
game.Players.PlayerAdded:Connect(
function(player)
player.CharacterAdded:Connect(
function(Character)
local Torso = Character:WaitForChild("HumanoidRootPart")
local tool = script.Parent
local Motor6D = Instance.new("Motor6D", Torso)
Motor6D.Part0 = Torso
end
)
end
)
game.ReplicatedStorage.MoveArms.OnServerEvent:Connect(
function(plr, Motor, ToolHandle)
Motor.Part1 = ToolHandle
end
)