Blah blah blah something about viewmodels
moving the players arms onto a part which is just constantly moved to the camera
although for some reason the animation just dont work when i move the arms
not entirely sure which category to post this under.
heres the code if it isnt a issue with the animation / viewmodel or whatever
local Player = game:GetService("Players").LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local RunService = game:GetService("RunService")
repeat task.wait() until game:IsLoaded()
repeat task.wait() until Character:IsDescendantOf(workspace)
-- Variables --
local Binded = false
local FTorso
local DebugMovementDelay = true
local DebugMovementDelayNum = 1
local BindRenderStep
local BindCoroutine
-- --
local RightUpperArm = Character:WaitForChild("RightUpperArm")
local LeftUpperArm = Character:WaitForChild("LeftUpperArm")
local RightArmMotor = Character:WaitForChild("RightUpperArm"):WaitForChild("RightShoulder")
local LeftArmMotor = Character:WaitForChild("LeftUpperArm"):WaitForChild("LeftShoulder")
local function BindArms()
if not Binded then
FTorso = Instance.new("Part")
FTorso.Anchored = true
FTorso.CanCollide = false
FTorso.CanQuery = false
FTorso.CanTouch = false
FTorso.Size = Vector3.new(
Character.UpperTorso.Size.X,
math.floor((Character.UpperTorso.Size.Y + Character.LowerTorso.Size.Y)),
Character.UpperTorso.Size.Z
)
FTorso.Parent = workspace.Camera
RightArmMotor.Part0 = FTorso
LeftArmMotor.Part0 = FTorso
RightArmMotor.Part0 = FTorso
LeftArmMotor.Part0 = FTorso
RightArmMotor.C0 = CFrame.new(RightUpperArm.Position) * CFrame.Angles(math.rad(90),0,0)
LeftArmMotor.C0 = CFrame.new(LeftUpperArm.Position) * CFrame.Angles(math.rad(90),0,0)
if DebugMovementDelay then
BindCoroutine = coroutine.create(function()
while task.wait(DebugMovementDelayNum) do
FTorso.CFrame = workspace.CurrentCamera.CFrame * CFrame.new(0,-2,-1)
end
end)
coroutine.resume(BindCoroutine)
else
BindCoroutine = coroutine.create(function()
BindRenderStep = RunService.RenderStepped:Connect(function()
FTorso.CFrame = workspace.CurrentCamera.CFrame * CFrame.new(0,-2,-1)
end)
end)
coroutine.resume(BindCoroutine)
end
else
warn("Arms already binded")
end
end
local function UnbindArms()
end
local Animator = Character:FindFirstChildWhichIsA("Humanoid").Animator
Animator:LoadAnimation(script.Animation):Play()
task.wait(2)
BindArms() -- doesnt matter if i bind the arms before or after the played animation they both have the same effect
-- Also the animation priority is at action4
