I was trying to play an animation inside the player, but it didn't work and there's no errors. Please help! Here is the script I used.
Local Script
local player = game.Players.LocalPlayer local char = player.Character or player.CharacterAdded:Wait() local uis = game:GetService("UserInputService") uis.InputBegan:Connect(function(key) if key = Enum.KeyCode.E then script.AnimationController:LoadAnimation(script.Animation):Play() end end)
Instead of an animationcontroller you should simply use the humanoid's LoadAnimation function and also please set the animation to a variable to allow it time to load.
also you need to do key.KeyCode, not key
local player = game.Players.LocalPlayer local char = player.Character or player.CharacterAdded:Wait() local uis = game:GetService("UserInputService") local anim = char:WaitForChild("Humanoid"):LoadAnimation(script.Animation) uis.InputBegan:Connect(function(key) if key.KeyCode = Enum.KeyCode.E then anim:Play() end end)