I need an animation that lifts the dummy’s arm then keeps it lifted, then resets when any other button is pressed. I can’t seem to make it work. Idk if it’s an animation issue or a script issue, as I am not fluent at creating animations. I’ve tried modifying the script and the animation, but my project is taking too long and I dont want to spend another half hour trying to figure this out. Thank you!
Here’s the function that moves the arm, I can provide more of the script if it’s needed.
--Functions
local function MoveCam()
local viewportItem = script.Parent.Item:FindFirstChildWhichIsA("Model").Name
local modelItemPart = character:FindFirstChild(viewportItem)
local cType = modelItemPart.CustomType
if cType.Value == "Holster" then
local cam = leftCam.CFrame
local tween = tweenService:Create(curCamera, tweenInfo, {CFrame = cam})
tween:Play()
liftLeft:Play()
wait(liftLeft.Length * 3 / 4)
liftLeft:AdjustSpeed(0)
elseif cType.Value == "Backpack" then
liftLeft:AdjustSpeed(1)
local cam = backpackCam.CFrame
local tween = tweenService:Create(curCamera, tweenInfo, {CFrame = cam})
tween: Play()
end
end
end)
My method of approach for this problem is to create an animation that loops the action that you want it to do. When you want to lift the arm down, you can manually call the function to stop the animation.
local anim = model.Animation1
local animationHandler = model.Humanoid:WaitForChild("animator")
local animF = animator:LoadAnimation(anim)
local animStatus = false
local function animateFunc(animStatus)
if animStatus == false then
--pause
else
--play
end
local function toggle()
animStatus = not animStatus
animFunc()
end
button.MouseButton1Click:Connect(toggle)
Would it look kinda like this? don’t critique the code, I just want to know if this is what you mean
I have the animation set up like so:
0 to 0.5 seconds - hand is down
0.5 to 1 second - hand moves up
1 to 1.5 seconds - hand is up
1.5 to 2 seconds - hand is moving down
local char = game.Workspace.CustomizationFolder.CustomCharacter
local animator = char.Humanoid:WaitForChild("Animator")
local anim = char.LiftLeft
local animF = animator:LoadAnimation(anim)
animF:Play()
animF:AdjustSpeed(0)
animF.Looped = true
local function toggle()
animF:AdjustSpeed(1)
task.wait(animF.Length / 2)
animF:AdjustSpeed(0)
end
script.Parent.MouseButton1Click:Connect(toggle)