Basically, how am I supposed to make the animation run (on players), when they left click? Also, will this work with any button (A, right click, D, etc.)?
Use UserInputService
Animations should always be client side
local UserInputService = game:GetService("UserInputService")
local player = game.Players.LocalPlayer or game.Players.PlayerAdded:Wait()
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = game.Players.LocalPlayer.Character:WaitForChild("Humanoid")
UserInputService.InputBegan:Connect(function(Input, gameProcess)
if Input.KeyCode == Enum.KeyCode.D then
--this if you want it to be a key.
end
if Input.UserInputType == Enum.UserInputType.MouseButton1 then
-- this is if you want to be a mouse click
local Animation = -- Make an animation object put in the script and place animation Id in object)
local AnimationLoad = humanoid:LoadAnimation(Animation)
AnimationLoad:Play() -- How to tell the script when to start the animation.
end
end)