Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Custom rig morph animation/emote combining with idle animation instead of playing on its own?

Asked by 2 years ago
Edited 2 years ago

I made a custom rig morph with a UI where you can do certain animations. The buttons play an animation when clicked. It plays the animation once without looping it. However, when I tested it, it didn't work. It basically combined the idle animation and the button's animation together, forming a weird, simple animation. I've tried making a thing where it stops and plays the idle animation, but didn't work. Here is the error that came out of the output and the main part of the script.

Error

Stop is not a valid member of Animation "Workspace.Office_Bucket.BaseAnimate.idle.Animation1"

Script

player = script.Parent.Parent.Parent.Parent.Parent.Parent.Character
function onClicked() -- You can edit these functions to do a certain thing. 
    if script.Parent.Parent.Parent:FindFirstChild("Action") ~= nil then --Don't edit this
    script.Parent.Parent.Parent.Action:Play()
end
local Animation = player.Humanoid:LoadAnimation(script.Emote)
  wait(0.1)
  player.BaseAnimate.idle.Animation1:Stop()
  wait(.1)
  Animation:Play()
  script.Disabled = true 
  script.Parent.Visible = false
  wait(1)
  player.BaseAnimate.idle.Animation1:Play()
  wait(.1)
  Animation:Stop()
  script.Disabled = false
  script.Parent.Visible = true
end

If anybody knows how to fix this, please tell me.

0
make sure that it is a local script to detect the button press leading into a remote event which then the regular script picks it up and makes the person to a animation CoopJava -52 — 2y
0
Is the animation high priority? ZIRFAL3 17 — 2y

1 answer

Log in to vote
0
Answered by 2 years ago
Edited 2 years ago

Hello, office! You used Animation:Stop() correctly, but however. In line 8, it tries to stop the Animation (animation1) itself, which isn't valid. Because you need to use LoadAnimation, which you have done on line 6, which is why Animation stops. But animation1 doesnt, because it isnt a loadanim animation.

Try combining all the scripts into one. This way, you can use LoadAnimation throughout different click functions, again, in one script. Example:

script.Parent.MouseButton1Click:Connect(function()
      print("Hello world!")
end)

script.Parent.ButtonPath.MouseButton1Click:Connect(function()
      print("Hello world!2")
end)

--and so on until every button is filled.

This makes it easier to identify each animation by number, and can use them in different functions. This way, you don't have to navigate in a script to a regular animation, but instead, identify them all by number with LoadAnimation (in click functions), and stop them when desired.

Tell me if this did or did not help!

Ad

Answer this question