I tried making an UserInputService, when player presses Q, the animation plays, and it worked fine.
But when I try to make the same but when the tool is clicked it doesn't work. I don't get any error or anything, it just won't play, am I missing something?!
local Mouse = game.Players.LocalPlayer:GetMouse() script.Parent.Activated:Connect(function() if Mouse.Target then if Mouse.Target.Parent:FindFirstChild("Humanoid") then print("There is humanoid") script.Parent.RemoteEvent:FireServer(Mouse.Target) game.Players.LocalPlayer.Character.Humanoid.Animator:LoadAnimation(game.ReplicatedStorage.Animation):Play() else print("No Humanoid") end end end)
Well It Might Not Be A Problem In Your Script, But Did You Add The Animation?
That's because Mouse.Target
has built-in filter for all Characters
. You can only do this using Raycasting.