I used player.Character to change the character to a model that has a humanoid. I can control it but not as soon as the code happens
Here is my code;
local RunService = game:GetService("RunService")
local player = game.Players.LocalPlayer
local Char = player.Character
hum = Char.Humanoid
local posses = game.Workspace.Dummy
local poshum = posses.Humanoid
local anim = game.Workspace.Dummy["running test"]
local anim2 = game.Workspace.Dummy["idle"]
local animationTrack = poshum:LoadAnimation(anim)
local animationTrack2 = poshum:LoadAnimation(anim2)
camera = workspace.CurrentCamera
player.Character = posses
camera.CameraSubject = posses.Head
isRunning = false
function prto ()
RunService.RenderStepped:Connect(function()
print(isRunning)
poshum.Running:Connect(function(speed)
if speed > 0 then
isRunning = true
else
isRunning = false
end
end)
end)
end
local spawno = coroutine.create(prto)
coroutine.resume(spawno)
while wait() do
if isRunning then
animationTrack:Play()
wait(animationTrack.Length)
animationTrack:AdjustSpeed(-1)
animationTrack:Play()
if not isRunning then
animationTrack:Stop()
end
end
end
