SCRIPT IN STARTERPLAYERSCRIPTS
local Player = game:GetService("Players").LocalPlayer local PlayAnimation = game.ReplicatedStorage.PlayAnimation --It states that its "unable to cast value to object" local StopAnimation = game.ReplicatedStorage.StopAnimation local Debounce = false function onKeyPress(actionName, userInputState, inputObject) if userInputState == Enum.UserInputState.Begin then PlayEmote() end end function PlayEmote() if Debounce == false then PlayAnimation:FireServer(2471625994) else StopAnimation() end end game.ContextActionService:BindAction("keyPress", onKeyPress, false, Enum.KeyCode.E)
SCRIPT IN SERVERSCRIPTSERVICE
game.ReplicatedStorage.PlayAnimation.OnServerEvent:Connect(function(Player,Animation) local Anim = game.Workspace[Player.Name].Humanoid:LoadAnimation(Animation) Anim:Play() game.ReplicatedStorage.StopAnimation.OnServerEvent:Connect(function(Player) Anim:Stop() end) end)
HOW IT WORKS: Basically, it's supposed to load an animation when you press E on the keyboard.