I am making a player controlled SCP 096 and he has a rage ability. Whenever they press E, it will load and play a charging animation. After 30 seconds, a rage animation will play. However, the script ends at this line here.
Why is it doing this?
local UIS = game:GetService("UserInputService")
local char = script.Parent
local head = script.Parent.Head
local hum = script.Parent.Humanoid
local keybind = Enum.KeyCode.E -- between the key for ability
local rage = true
local cooldown = 30
UIS.InputBegan:Connect(function(input,gameprocessed)
if gameprocessed then return end
if not rage then return end
if input.KeyCode == keybind then
rage = false
local Charge = Instance.new('Animation')
Charge.AnimationId = 'rbxassetid://14288885367'
local PlayCharge = char.Humanoid:LoadAnimation(char)
PlayCharge:Play()
hum.WalkSpeed = 0
head.Triggered:Play()
wait(3.5)
head.Charge:Play()
wait(30.5)
head.Charge:Stop()
PlayCharge:Stop()
head.Rage:Play()
hum.WalkSpeed = 35
local Rage = Instance.new('Animation')
Rage.AnimationId = 'rbxassetid://14288872282'
local PlayAnim = char.Humanoid:LoadAnimation(Rage)
PlayAnim:Play()
head.Ambience:Play()
wait(25)
head.Ambience:Stop()
head.Rage:Stop()
hum.WalkSpeed = 8
PlayAnim:Stop()
wait(cooldown)
rage = true
end
end)
Char is not a animation instance, You should load the animation called “Charge”. I also recommend playing the animation on the Humanoid animator and not the humanoid.
local UIS = game:GetService("UserInputService")
local Char = script.Parent
local Head = Char:WaitForChild("Head")
local Humanoid = Char:WaitForChild("Humanoid")
local Animator = Humanoid:WaitForChild("Animator")
local keybind = Enum.KeyCode.E -- between the key for ability
local rage = true
local cooldown = 30
local RageAnim = script.Animation
UIS.InputBegan:Connect(function(input,Gp)
if not Gp and input.KeyCode == keybind then
if rage == true then
rage = false
local Anim = Animator:LoadAnimation(RageAnim)
Anim:Play()
wait(cooldown)
rage = true
end
end
end)
Are you sure this is the right script you are sending me a view of in the error it says the script is located in an instance called “Nexxxussss”. However, The one you’re sending me a pic of is called 096.
It is not a problem if the animation is not viewable inside of the explorer, because using that way of getting an animation makes it so that the animation instance doesn’t need a parent to still be usable inside a local script.
Yes, I saw that mistake, I pointed it out on the first post although I assume the script can’t find the child called RageAnim because the script loads before the RageAnim.
I just have one more question. And while the script does work now in playing the animations, it seems that the idle animation/walking animation still affect in how the charge/rage animation plays. The charge is set to Action3, while Rage is Action4. Walking is movement and idle is idle. Why does it still affect the way it looks?
I am sure. Whenever the charging animation plays, it does play, however, it still seems like the idle animation is effecting the way it is. For example, during the idle animation the humanoid is slouched down. But in the charging animation the arms just go up, thats it. But the humanoid is still slouched.
If the custom animation you made doesn’t move the torso at all then it won’t effect how the torso moves, try changing the rotation of the torso a bit. If that doesn’t work you can always just set the animation priority to action.