The script is like a magic move that you can use on others and I want to be able to press T then click on the target and work and this is the script I am currently using:
local player = game.Players.LocalPlayer repeat wait() until player.Character.Humanoid local humanoid = player.Character.Humanoid local mouse = player:GetMouse() local UIS = game:GetService("UserInputService") local anim = Instance.new("Animation") anim.AnimationId = "https://www.roblox.com/asset/?id='5480157154' mouse.KeyDown:connect(function(key) if key == "t" then local playAnim = humanoid:LoadAnimation(anim) playAnim:Play() end end)
If you know please do answer below as I am eager to find out. the solution.
Next time, please use UserInputService
as KeyDown
is deprecated, however upon reading your script I have seen that you made a mistake about the animation Id.
Please replace:
anim.AnimationId = "https://www.roblox.com/asset/?id='5480157154'
To:
anim.AnimationId = "https://www.roblox.com/asset/?id=5480157154"
Make sure that you own the animation otherwise it won't work. Roblox doesn't allow animation-sharing to others.
Try changing the parent of your animation inside the script:
anim.Parent = script
Might be the way you're detecting the keydown. Also, use rbxassetid instead of the way you did it.
local player = game.Players.LocalPlayer repeat wait() until player.Character.Humanoid local humanoid = player.Character.Humanoid local mouse = player:GetMouse() local UIS = game:GetService("UserInputService") local anim = Instance.new("Animation") anim.AnimationId = "rbxassetid://5480157154' UIS.InputBegan:Connect(function(input, process) if not process then if input.KeyCode == Enum.KeyCode.T then local playAnim = humanoid:LoadAnimation(anim) playAnim:Play() end end end)
Cheers, Zander