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

How do I replace the slash animation with my own?Please Help!

Im trying to change the animations, but I don't know how.

the id of keyframesequence: 10123018321

Script:

local tool = script.Parent
local canDamage = false



local function onTouch(otherPart)
	local humanoid = otherPart.Parent:FindFirstChild("Humanoid")
	if not humanoid then 
		return 
	end


	if humanoid.Parent ~= tool.Parent and canDamage then 
		humanoid:TakeDamage(400)
	else
		return
	end


	canDamage = false
end



local function slash()
	local str = Instance.new("StringValue")
	str.Name = "toolanim"
	str.Value = "Slash" 
	str.Parent = tool
	canDamage = true
end



tool.Activated:Connect(slash)

tool.Handle.Touched:Connect(onTouch)

Please Help!

2 answers

Make your own in the animation editor, then replace it with your animation id.

You would need to rewrite this function, right now it uses some function that roblox has which I believe detects when an object named "toolanim" is created. Instead of using this, value u can make the character play an animation here. I recommend you rescript the tool so the animations and tool work properly.

local function slash()
    local str = Instance.new("StringValue")
    str.Name = "toolanim"
    str.Value = "Slash" 
    str.Parent = tool
    canDamage = true
end

3 comments

0

wat

0

https://developer.roblox.com/en-us/api-reference/class/Animation, use this to learn more about how to use animations. you would replace the slash function with the animation

0

ok ty

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