Roblox Studio Анимации
Проблема с анимациями, они то проигрываются, но коряво. Спустя пару секунд анимация начинает замедляться и персонаж просто не двигает ни руками ни ногами. Анимация бесконечная, стоит на 1x. (если сделать анимацию конечной - ничего не поменяется)
repeat wait() until game.Players.LocalPlayer.Character
local UIS = game:GetService('UserInputService')
local Bar = script.Parent:WaitForChild('Background'):WaitForChild('Bar')
local player = game.Players.LocalPlayer
local NormalWalkSpeed = 10
local NewWalkSpeed = 25
local power = 10
local sprinting = false
local character = player.Character
local Animation_id = "http://www.roblox.com/asset/?id=12844678110"
R6_run_animation = Instance.new("Animation")
R6_run_animation.AnimationId = Animation_id
UIS.InputBegan:connect(function(key)
if key.KeyCode == Enum.KeyCode.LeftShift then
character.Humanoid.WalkSpeed = NewWalkSpeed
sprinting = true
while power > 0 and sprinting == true do
power = power - 0.03
Bar:TweenSize(UDim2.new(power / 10, 0, 1, 0), 'Out', 'Quint', 0.1, true)
wait()
if power <= 0 then
character.Humanoid.WalkSpeed = NormalWalkSpeed
end
if sprinting == true then
local playAnim = player.Character.Humanoid:LoadAnimation(R6_run_animation)
playAnim:Play()
end
end
end
end)
UIS.InputEnded:connect(function(key)
if key.KeyCode == Enum.KeyCode.LeftShift then
character.Humanoid.WalkSpeed = NormalWalkSpeed
sprinting = false
while power < 10 and sprinting == false do
power = power + 0.03
Bar:TweenSize(UDim2.new(power / 10, 0, 1, 0), 'Out', 'Quint', .1, true)
wait()
if power <= 0 then
character.Humanoid.WalkSpeed = NormalWalkSpeed
end
if sprinting == false then
local playAnim = player.Character.Humanoid:LoadAnimation(R6_run_animation)
playAnim:Stop()
end
end
end
end)
Как не должно быть:
Как должно быть: