Make an animation play when another player is clicked

  1. What do you want to achieve? Make an animation play for 2 players. Me, and another player that was clicked on.

  2. What is the issue? I have made an animation in Moon Animator for 2 players (exported separately), and I want to be able to click on another player and play the animations. I already got the script for playing the animation for me and a dummy, but I don’t know how to get the player that was clicked on to do the animation with me instead of the dummy. (Sorry if it’s confusing).

  3. What solutions have you tried so far? I tried to search on Devforum and on Youtube, but no answers.

-- This is just what I have right now.

local Animator = game.Players.LocalPlayer.Character:WaitForChild("Humanoid"):WaitForChild("Animator")
local Animator2 = game.Workspace.ChokeAnimation.Dummy2:WaitForChild("Humanoid"):WaitForChild("Animator")
local Animation1 = script:WaitForChild("ChokeAnim1")
local Animation2 = script:WaitForChild("ChokeAnim2")
local animtrack = Animator:LoadAnimation(Animation1)
local animtrack2 = Animator2:LoadAnimation(Animation2)
wait(5)
animtrack:Play()
animtrack2:Play()
2 Likes

You can insert a click detector in the player and when it’s used play the animation

game.Players.PlayerAdded:Connect(function(player)
        player.CharacterAdded:Connect(function(character)
                local Click = Instance.new("ClickDetector")
                Click.Parent = character
        end)
end)

Btw check if the parent of the click detector is the character of the player who clicked if not play the animation

Thanks for the help, but also how would I access the ‘Click’ in ‘Animator2’ if it’s outside the function?

1 Like

Well, if I think about what you meant you should use :WaitForChild(“ClickDetector”) on the player

1 Like