could anyone help me. i want a pushing animation to play when player presses a button, “e” for example
I already have an animation. now i just need the code to play this animation on the player when the player presses e
hope yall can help :))
also please try to explain what you are telling me, im kinda new in making games so im still learning.
You could try to use UserInputService if you know what that is.
local UserInputService = game:GetService("UserInputService")
local animation = Instance.new("Animation", workspace)
animation.AnimationId = "rbxassetid://INSERTANIMATIONIDHERE"
if input.KeyCode == Enum.KeyCode.E then
for i,v in pairs(workspace:GetDescendants()) do
if v.Name == "Humanoid" then
(This isn’t tested but its something like this!)
I would do this
Put a local in starterCharacterScripts
And put an animation in there with your animationId
You don’t need to loop through the workspace:GetDescendants() for “Humanoid” when you can get the humanoid from the player.Character