Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I make it when I click a button, it plays a animation on a different model?

Hello.

I’m trying to make a trick or treating system for one of my game updates. (Pre preparing) I’ve got it all down, now I just need to make the door bell. When I click the door bell. I want a animation to play on one of the models (DoorBellSysten, models inside: doorbell, door) Can anyone help me?

1 comment

0

What model? Is it like a npc model? or are you animating the door?

1 answer

So you would actually get the model's Animation Controller Instance (whether that be an AnimationController or Humanoid).

local model = workspace.Model; -- Change this to the model to play animation on
local animID = "AnimationID Here";
local animation = game.ReplicatedStorage.Animation or Instance.new("Animation");
animation.Parent = game.ReplicatedStorage;
animation.AnimationId = animID;
local player = model:FindFirstChildOfClass("Humanoid") or model:FindFirstChildOfClass("AnimationController");
local animationPlayer = player:LoadAnimation(animation);
-- To play, just do animationPlayer:Play();

1 comment

0

I don’t get this, I thought it would be door = workspace.DoorBellSystem.Door doorbell = workspace.DoorbellSystem.Doorbell.Clickdetector on MouseButton1Click:Play(workspace.doorbellsystem.door.anim). Though I’m prolly completely wrong since I’m a noob. Can you explain what’s happening

This discussion is preserved as it was. New answers, comments, and votes are closed.