Hi, I’ve been trying to make an arm system work for the past day, and I finnaly got it to work on the client, but when I play animations, it breaks, on the server.
Local Script in starter character scripts:
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local plr = Players.LocalPlayer
local char = plr.Character
local mouse = plr:GetMouse()
local camera = workspace.CurrentCamera
local CameraPos = char:FindFirstChild("CameraPos")
local armOffset = char.Torso.CFrame:Inverse() * char["Right Arm"].CFrame + Vector3.new(0, .5, -1)
local armOffset2 = char.Torso.CFrame:Inverse() * char["Left Arm"].CFrame + Vector3.new(0, .5, -1)
local armWeld = Instance.new("Weld")
armWeld.Part0 = char.Torso
armWeld.Part1 = char["Right Arm"]
armWeld.Parent = char
local armWeld2 = Instance.new("Weld")
armWeld2.Part0 = char.Torso
armWeld2.Part1 = char["Left Arm"]
armWeld2.Parent = char
RunService.Heartbeat:Connect(function()
camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = CameraPos.CFrame
local cframe = CFrame.new(char.Torso.Position, mouse.Hit.Position) * CFrame.Angles(math.pi/2, 0, 0)
armWeld.C0 = armOffset * char.Torso.CFrame:toObjectSpace(cframe)
local cframe2 = CFrame.new(char.Torso.Position, mouse.Hit.Position) * CFrame.Angles(math.pi/2, 0, 0)
armWeld2.C0 = armOffset2 * char.Torso.CFrame:toObjectSpace(cframe2)
end)
local Game = game
local RunService = Game:GetService("RunService")
local Players = Game:GetService("Players")
local Player = Players.LocalPlayer
local Mouse = Player:GetMouse()
local Character = Player.Character or Player.CharacterAdded:Wait()
local HumanoidRootPart = Character:FindFirstChild("HumanoidRootPart") or Character:WaitForChild("HumanoidRootPart")
while true do
local Time = 0
while true do
if Time > math.deg(math.pi / 2) then break end
local Pivot = Character:GetPivot()
local CF = CFrame.lookAt(Pivot.Position, Vector3.new(Mouse.Hit.X, Pivot.Y, Mouse.Hit.Z))
Character:PivotTo(Pivot:Lerp(CF, Time / math.deg(math.pi / 1.3))) ----------------------------- SPEED -----------------------------------
Time += RunService.RenderStepped:Wait()
end
end
Video of client versus server, plus what the animation looks like in editor: