Cutscene script some lines don't trigger

Hey there, so I made a cutscene script that triggers once you touch the red part and everything works up until it starts I can somehow still move during the cutscene and move around with the animation which shouldn’t happen, if anyone could tell me what I did wrong in the code would help alot

-- Cutscene Start
touchpart.Touched:Connect(function(hit)
	if debounce then return	end
	debounce = true
	game.ReplicatedStorage.BindableEvent.AnimationScene:Fire()
	wait(1)
	cam.CameraType = Enum.CameraType.Attach
	Character:MoveTo(beginpart.Position)
	game.StarterPlayer.StarterCharacterScripts.Controls_1st.Enabled = false
	Character.HumanoidRootPart.CFrame = beginpart.CFrame
	Player.CameraMode = Enum.CameraMode.LockFirstPerson
	--wait(0.01)
	Player.Character:WaitForChild("Humanoid").WalkSpeed = 0
	Player.Character:WaitForChild("Humanoid").JumpHeight = 0
	cam.CameraSubject = head
	track:Play()
	-- Cutscene End
	track.Ended:Wait()
	Player.CameraMode = Enum.CameraMode.Classic
	cam.CameraType = Enum.CameraType.Scriptable
	game.StarterPlayer.StarterCharacterScripts.Controls_1st.Enabled = true
	Player.Character:WaitForChild("Humanoid").WalkSpeed = 16
	Player.Character:WaitForChild("Humanoid").JumpHeight = 7.2
	game.ReplicatedStorage.BindableEvent.AnimationScene:Fire()
	wait(1)
	Character:MoveTo(endpart.Position)
end)

Video of my problem:

I think because instead of saying if Track.Ended = true then, you just went ahead and put up Track.Ended:wait(). I don’t think your current script would work because it’s all in the same function and the server doesn’t know which part of the script to follow. I recommend just changing the track ended bit to if Track.Ended = true then.

Basically after the —Cutscene end— bit, write if Track.Ended = true then . instead of track.ended:Wait()

I tried it out like u said and I still get the same result

Try disableing the player’s controls instead of setting their walkspeed to 0:

local controls = require(Player.PlayerScripts.PlayerModule):GetControls()

Controls:Disable()

1 Like

Ah man I don’t really know then, I’ll try to look around about it but idk if I’ll find a result. Maybe wait a bit and see if anyone else will respond

I did that now and it did remove the ability to walk but I still have the problem that I can move the animation with my camera somehow

Yeah I see really appreciate the effort his solution did work to make it so I cant walk but I still have the issue like I said above that I can move the animation with my camera somehow I don’t want that to happen I really have no clue what does it since I did the script similarly to other cutscene scripts and it never did that ever

Try to lock the position of the camera somehow, I don’t really know how to actually write out to lock it though.

What do you mean by moving the animation with your camera?

Like when the cutscene begins the animation plays thats fine but I can move around my camera/mouse during that and the animation goes with the camera, if i turn right with my mouse the animation also turns right


This is what I mean

I see well I’d also have no clue how to do that exactly

Try searching up how to lock position of camera while in first person Roblox studio

To simply lock a camera, you just need to basically set the camera’s type to scriptable as shown in the examples below.
asdasdasdasda
to
dasdasdasdasd

1 Like

I tried it out in this form but I still get the same results

It works now, the only issue with it was the order of some of the lines I changed them and it works perfectly now. thank you to everyone who took the effort to try and help me out

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.