Hi, so I am making a script that Utalises the UserInputService where when you click, an animation plays, but as you could guess it does not work. I have already looked through the roblox dev forum and to my knowledge I am doing everything correct; the animation priority is set to core, I am using a local script inside StarterCharacterScripts,and the code is riight (I have no errors in the output and no typos.) This is the code:
local service = game:GetService("UserInputService")
local Player = game.Players.LocalPlayer -- this also only works in LocalScripts local Character = Player.Character local Humanoid = Character:WaitForChild("Humanoid")
local Animation = Instance.new("Animation") Animation.AnimationId = "rbxassetid://6723323427"
local Track = Humanoid:LoadAnimation(Animation)
service.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 then print("button is down") Track:Play() end end)
May I have some help please.
Humanoid:LoadAnimation() is deprecated. Try inserting an Animator into the Humanoid, then use
local Track = Humanoid.Animator:LoadAnimation(Animation)
hope this helps