so I have this dead by daylight-esk hook model that locks a target in place, waits a bit, and then lets them "struggle" to break the hook. there are 3 animations in place for this: hooking, idle, and struggling
what I'm currently doing:
local target = script:WaitForChild(plr).Value -- I use a stringvalue object to store the player name, this makes a bit more sense in the grand scheme of my setup
target.HumanoidRootPart.Anchored = true
target.HumanoidRootPart.CFrame = workspace.Hook.Tele.CFrame
target.Humanoid:LoadAnimation(game.Workspace.Hook.idle):Play() -- the animation I wanna play here
why does nothing happen when using this script? I looked up the LoadAnimation function and the dev API says it's deprecated, so what should I use instead? edit: by nothing happening I mean that the animations don't play at all, anchoring the hrp and setting the cframe works totally fine
edit 2: so after the first response I got, this is my code now:
local Character = game:GetService("Workspace")[script.plr.Value]
local Humanoid = Character:FindFirstChildWhichIsA("Humanoid") or Character:WaitForChild("Humanoid")
local Animator = Humanoid:FindFirstChildWhichIsA("Animator")
local idle = script.idle
local idleanim = Animator:LoadAnimation(idle)
local hooked = script.hooked
local hookedanim = Animator:LoadAnimation(hooked)
local struggle = script.struggle
local struggleanim = Animator:LoadAnimation(struggle)
Character.Parent = script.Hook
script.Hook.Tele["music1"]:Play()
Character.HumanoidRootPart.Anchored = true
Character.HumanoidRootPart.CFrame = script.Hook.Tele.CFrame
idleanim:Play()
wait(0.1)
script.Hook.Part.scream:Play()
hookedanim:Play()
as you can see I now use the "Animator" instance in the player, define variables for each of the animations and then call :Play() on them when needed, but this still does not work. the animation just doesn't seem to play. there's nothing wrong with the Animation object in the script or the animation id, it plays fine in the btroblox preview on the website. I'm truly lost here

1 comment
i tried this and added the Play() functions at the proper times, read my edit and see if i did anything wrong