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

How would you make a Key Animation?

How would you create a script, that would not only play an animation, but would damage the player, when you press "e", or any simple key..

1 answer

Try this (might not work):

local Player = game:GetService("Players").LocalPlayer
local Character = Player:WaitForChild("Character")
local Humanoid = Character:WaitForChild("Humanoid")
local Mouse = Player:GetMouse()
local ID = 1337 --change to your animation id
local Animation = Instance.new("Animation", Player.Character)
Animation.AnimationId = ID

Mouse.KeyDown:connect(function(k)
	if k == "e" then
		Humanoid:LoadAnimation(Animation)
		Humanoid:TakeDamage(10) --change 10 to your amount
	end
end)

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