I want an animation/cutscene to play when the player presses the F key I’ve made an animation that shows a battery from the players backpack dropping into their hand. However, when I play the animation nothing happens except the sound effect and camera zoom. The backpack is animatable in the animation editor and is welded to the player. No errors in either script.
Local Script
Volt = {
Activate = function()
local plr = game.Players.LocalPlayer
local character = plr.Character or plr.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local animator = humanoid:WaitForChild("Animator")
-- Create new "Animation" instance
local activateAnim = Instance.new("Animation")
-- Set its "AnimationId" to the corresponding animation asset ID
activateAnim.AnimationId = "rbxassetid://114065009669211"
-- Load animation onto the animator
local activateAnimTrack = animator:LoadAnimation(activateAnim)
-- Connect "GetMarkerReachedSignal" event to a specific named keyframe
activateAnimTrack:GetMarkerReachedSignal("CameraAtBack"):Connect(function()
workspace.CurrentCamera.CFrame = workspace.test
end)
end,
},
-- Some other code
uis.InputBegan:Connect(function(input, gpe)
print("input began")
if not gpe and input.KeyCode == Enum.KeyCode.F and canUse then
canUse = false
print(plr.Character.CharacterName.Value)
pcall(animations[plr.Character.CharacterName.Value].Activate(), function()
warn("There was an error")
end)
useAbilityRM:FireServer(currentCharacter)
abilitySound:Play()
camModule:SetCameraView("AbilityZoom")
task.wait(1.5)
camModule:SetCameraView("SideCamera")
task.wait(14)
canUse = true
end
end)
Server Code
Volt = {
Activate = function(plr)
print("ability was activated")
local defaultVFX = game.ReplicatedStorage["Default Ability VFX"]:Clone()
defaultVFX.Attachment.ParticleEmitter.Enabled = true
defaultVFX.Parent = plr.Character
defaultVFX.Position = plr.Character.HumanoidRootPart.Position
--startAnimation:FireClient(plr, "rbxassetid://99233828693822")
plr.Character.Humanoid.WalkSpeed = 0
task.wait(1.5)
plr.Character.Humanoid.WalkSpeed = 500
task.wait(1)
defaultVFX:Destroy()
task.wait(9)
plr.Character.Humanoid.WalkSpeed = 100
end,
}
--others
}
useAbilityRM.OnServerEvent:Connect(function(plr, characterName)
pcall(abilities[characterName].Activate(plr), function()
warn("There was an error")
end)
end)