Tool animation function

----// Storage \ ----

local Tool = script.Parent.Parent

local Handle = Tool:WaitForChild(“Handle”)
local Emitter = Tool:WaitForChild(“Emitter”)

local Remote = script.Parent:WaitForChild(“SaberEvent”)
local animation = 2235777768
local On = false

----// Set Up \ ----

----// Functions \ ----

----// Main \ ----

Remote.OnServerEvent:connect(function (Player, Type)

if Type == "Ignite" then
	if On == false then
		On = true
		Handle.Ignite:Play()
		Handle.Hum:Play()
		On = true
		for _,v in pairs (Emitter:GetChildren()) do
			
			if v.ClassName == "ParticleEmitter" then
				v.Enabled = true		
			end
			
		end
	else
		On = false
		Handle.Sheathe:Play()
		Handle.Hum:Stop()
		On = false
		
		local Emits = {}	
		
		for _,v in pairs (Emitter:GetChildren()) do
			
			if v.ClassName == "ParticleEmitter" then
				table.insert(Emits, v)
				v.Enabled = false
				v.Parent = nil		
			end
			
		end
		
		for i = 1, #Emits do
			Emits[i].Parent = Emitter
		end
	end
end

end)

Remote.OnServerEvent:connect(function (Player, Type)
– animation code

end)

I am trying to figure out on how to make a animation start when you press a certain key. The only issue I have is making the animaton function

1 Like

Okay.

Throwing a script on Scripting Support and making a statement isn’t quite the point of this category. This is for receiving help and pointers with code, not for asking for code. In addition to that, your thread is rather vague. Please ensure you’ve met standards with the category guidelines before asking a question.

Have you searched the Developer Hub for any of this yet? There are a lot of articles related to animation that you can read up on, as well as documentation on related objects. Think of what you want and try entering search terms to find it. You can also use Google. Something as simple as “key down function Roblox” would probably even work out.

1 Like

As colbert says you can find a lot of answers and information just by doing a quick search


the api is really useful, and they tend to have examples as well

1 Like