Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Simple Animation Problem: Animation cuts out?

Problem with animation: https://gyazo.com/9a545dd2e13f8e2054e24cadbbb9bf1a

I made an animation that plays whenever the player runs while wielding the sword with the script below. It kind of works -- as seen by the link above -- however it gets cut off a lot. I've tried some different things such as:

-- Changing the priority(I tried every single one)

-- Disabling the "Animate" Script in the character

-- Changing the duration of the animation

-- Using a remote function(As seen in my current script)

-- Reading the Wikia

What else can I do? I was thinking of replacing the default Roblox run animation when the weapon is equipped but I read on the Wikia that it doesn't work anymore.

Server script inside sword(Part of the script):

local repStorage = game:GetService("ReplicatedStorage")
function Equipped()
	Character = Tool.Parent
	Player = Players:GetPlayerFromCharacter(Character)
	Humanoid = Character:FindFirstChild("Humanoid")
	RootPart = Character:FindFirstChild("HumanoidRootPart")
	if not CheckIfAlive() then
		return
	end
	ToolEquipped = true
	Humanoid.Running:Connect(function()	
		local a = repStorage:WaitForChild("PlayAnim")
		a:FireServer()
	end)
end

Tool.Equipped:connect(Equipped)

Server Script in ServerScriptService:

local repStorage = game:GetService("ReplicatedStorage")
local remote = repStorage:WaitForChild("PlayAnim")

--//Remote Event//--
remote.OnServerEvent:Connect(function(player)
	local run = player.Character.Humanoid:LoadAnimation(game.ReplicatedStorage.Anim.SwordRun)
	run:Play()			
end)

3 comments

0

Is the animation looped?

0

@magicguy78942 I couldn't find a "loop" button on the new Roblox Animation UI

0

I found an animation plugin with the "loop" option. This is what happened after the loop: https://gyazo.com/cf085f86799915e1e222a8e0e87e0e28

1 answer

Okay so the Humanoid.Running event gets fired every time the player starts to run or stop try it out to see what happens add a print inside the Humanoid.Running event.What I suggest you do is try to replace the run anim and walk with your animation it is in side the character.Animate.walk but also change the run

Read more on Humanoid.Running https://wiki.roblox.com/index.php?title=API:Class/Humanoid/Running

This discussion is preserved as it was. New answers, comments, and votes are closed.