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.

2 Likes

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) / --

button.Activated:Connect(function()
	print("Button Clicked")
	wait()
	Animate:FireServer()
end)

Server script inside ServerScriptService

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

Animate.OnServerEvent:Connect(function(player)
	
	-- / Animation / --
	
	local Animation = Instance.new("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)
		
		walkAnimation:Play()
		print("Walk animation played")
	end
end)

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