Code Printing Successfully, Not Working

Hi! I’m making a cutscene and I need your character to walk to certain spots for it. There are 2 scripts. The prints work, but nothing happens.
Edit: There are also no errors.

Server Script
game.ReplicatedStorage.PathfindEvent.OnServerEvent:Connect(function(Player,destination)
	print("a")
	-- Variables
	local humanoid = Player.Character.Humanoid
	local body = Player.Character:FindFirstChild("HumanoidRootPart") or Player.Character:FindFirstChild("Torso")
	local pathfindingService = game:GetService("PathfindingService")
	-- Create Path Instance
	local path = pathfindingService:CreatePath()
	-- Make a Path
	path:ComputeAsync(body.Position, destination.Position)
	-- Get Waypoints
	local waypoints = path:GetWaypoints()
	-- Move to all waypoints
	for k, waypoint in pairs(waypoints) do
		humanoid:MoveTo(waypoint.Position)
		-- Let Humanoid Jump if Needed
		if waypoint.Action == Enum.PathWaypointAction.Jump then
			humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
		end
		humanoid.MoveToFinished:Wait()
		print("b")
	end
end)
Local Script
game.Workspace.CutsceneHitbox.Touched:Connect(function(Hit)
	if game:GetService("CollectionService"):HasTag(Hit.Parent,"InCutscene") then
		return
	end
	if Hit.Parent == game.Players.LocalPlayer.Character then
		game:GetService("CollectionService"):AddTag(Hit.Parent,"InCutscene")
		local Camera = game.Workspace.CurrentCamera
		local Player = game.Players.LocalPlayer
		local Papyrus = game.Lighting.Papyrus or game.Workspace.Papyrus
		Player.Character.Humanoid.JumpPower = 0
		Player.Character.Humanoid.WalkSpeed = 0
		Camera.CameraType = Enum.CameraType.Scriptable
		game:GetService("TweenService"):Create(Camera,TweenInfo.new(
		1,
		Enum.EasingStyle.Circular,
		Enum.EasingDirection.Out,
		0,
		false,
		0
		),{
			CFrame = game.Workspace.CutsceneCameraBehindPillar.CFrame
		}):Play()
		game.ReplicatedStorage.MovementEvent:FireServer("Disable")
		wait(2)
		Papyrus.Parent = game.Workspace
		game.Workspace["Judgement Hall"].Wall2.WindowToRemove.Parent = game.Lighting
		game:GetService("TweenService"):Create(Camera,TweenInfo.new(
		1,
		Enum.EasingStyle.Sine,
		Enum.EasingDirection.Out,
		0,
		false,
		0
		),{
			CFrame = game.Workspace.CutsceneCameraPapyrus.CFrame
		}):Play()
		game.ReplicatedStorage.PathfindEvent:FireServer(game.Workspace.PapyrusCutsceneMoveToZone)
		wait(1.5)
		local ChatService = game:GetService("Chat")
		ChatService:Chat(Papyrus.Head,"heya.")
		wait(3)
		ChatService:Chat(Papyrus.Head,"so, you've been busy, huh?")
	else
		return
	end
end)

Edit: Showed the full Local Script
Edit: There’s also a custom StarterCharacter rig. StarterCharacter.rbxm (31.6 KB)

Because your remote is likely firing and receiving before the character loads in. Add a wait() to either the client or server or connect it with a CharacterAdded event on the server. Some way to delay the code so it doesn’t run instantaneously upon the Studio test.

1 Like

No, it’s on a cutscene which is triggered upon a certain time, after the character loads in.

Yeah, on top of that you might want to disable the player’s movement so that they can’t move during the cutscene. You have to disable movement from the client with the following:

local controls = require(game:GetService("Players").LocalPlayer.PlayerScripts.PlayerModule):GetControls()
controls:Disable()
1 Like

Oh, I set their movement to Scriptable, and both WalkSpeed and JumpPower set to 0, should I do this instead?

Oh what you have works. It must be something else. Do they not move at all? Or do they move some and get stuck?

1 Like

They don’t move at all, just stand there.

Does it print “b” multiple times?

1 Like

Yes, it does print “b” multiple times.
2-3 times, sometimes 5, it’s not a far walk.

Is your custom character stuck to a part or anything, any welds welded to perhaps any part? I did check out your custom character and found some welds welded to CutsceneCameraPapyrus.

1 Like

They can move, you walk into a cutscene detector to start it.
Just checked there are no welds.

I did a repro and I believe you should remove this line where you’re setting the walkspeed to 0. I don’t believe MoveTo/Pathfinding will work if the player’s walkspeed is set to 0.

Try removing these lines:

Player.Character.Humanoid.JumpPower = 0
Player.Character.Humanoid.WalkSpeed = 0

and replacing it with the above suggested way to disable controls:

local controls = require(game:GetService("Players").LocalPlayer.PlayerScripts.PlayerModule):GetControls()  --- set as a variable
controls:Disable()
1 Like