#How do I make a player play an animation on keybind

1 messages · Page 1 of 1 (latest)

wanton kraken
#

I'm extremely new to lua, and I am very bad at it. That being said, my current code is meant to play an animation for the player when a keybind (E) is pressed. However, it does nothing. Here's the code: local UserInputService = game:GetService("UserInputService")
local Animation = script.Animation

UserInputService.InputBegan:Connect(function(Input)
if Input.KeyCode == Enum.KeyCode.E then
local Player = game.Players.LocalPlayer
local Character = Player.Character
local Humanoid = Character:WaitForChild("Humanoid")
print("O")
local Anim = Humanoid:LoadAnimation(Animation)
print("X")
Anim:Play()
end
end)

jovial rivet
#

is it a local script

wanton kraken
#

the animation is attatched to the localscript and i've checked the id multiple times

jovial rivet
#

is there any errors

wanton kraken
#

i have one

#

its this

#

wait

#

wrong msg

#

no there arent any

#

I've tried with different animations too and it doesnt work

jovial rivet
#

well it works for me

#

where is the script located

wanton kraken
#

starterplayerscripts

#

holdup

#

i might be dumb

#

i might be using r15 instead of r6

#

gotta restart my studio to check wait a sec

#

Do you need a script to change StarterPlayer avatar types to r6

sand beaconBOT
#

studio** You are now Level 1! **studio

tulip herald