Roblox animations breaking my cutscenes

Hey , I am having a problem with my game where my cutscene breaks If I add a custom animation for the player.
I am using a simple thing where you have a block that is the camera and it functions as a camera when you join the game. You can press an TextButton on the screen to Disable the camera for yourself.
The PROBLEM is whenever I try to add a local script to starterplayerscripts with a script to change the players animation the “cutscene” and camera stops working.
The Text button doesn’t work anymore and doesn’t go out of the cutscene when pressed like it does without the animation script. I checked that the Button’s script should be okay, but I don’t know how to add the animation if the cutscenes and cameras break.


Try this one, it starts the animation after the button is clicked

Local Script Inside the button

-- / Service(s) / --

local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")

-- / Essential(s) / --

local button = script.Parent

local Animate = ReplicatedStorage.Animate

-- / Function(s) / --

	print("Button Clicked")

Server script inside ServerScriptService

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Animate = ReplicatedStorage.Animate

	-- / Animation / --
	local Animation ="Animation") --Creates the animation
	Animation.AnimationId = "rbxassetid://616163682"
	Animation.Parent = ReplicatedStorage
	Animation.Name = "Animation"
	-- / Animator / --
	local Animation = ReplicatedStorage.Animation
	local char = player.Character
	local humanoid = char:FindFirstChild("Humanoid")
	local animator = humanoid:FindFirstChild("Animator")
	-- / Animator Started / --
	if animator then
		local walkAnimation = animator:LoadAnimation(Animation)
		print("Walk animation played")

Remember to change the things in the script according to your game, i hope this helps you c:

Oh yeah sorry ,I didn’t realise the animation can just wait for the cutscene