I have tried this so far. Basically, the camera will be connected to a part and it will stun the player while it is connected. Tell me what I have wrong, it will be appreciated.
repeat wait() until game:GetService("Players").LocalPlayer.Character ~= nil
local Player = game:GetService("Players").LocalPlayer
local Character = Player.Character
local Torso = Character.Torso
local Humanoid = Character:WaitForChild("Humanoid")
local Camera = workspace.CurrentCamera
local NotMoving = true
while NotMoving == true do
wait()
Humanoid.WalkSpeed = 0
Humanoid.Changed:connect(function() Humanoid.Jump = false end)
Camera.CameraType = "Scriptable"
Camera.CoordinateFrame = workspace.CameraPart.CFrame -- CameraPart is the part which the camera will be connected to.
end

4 comments
Not working as well, do you think that where I have placed the script is the matter here? It's in workspace.
Yes, you cannot change the camera in a script, it has to be a local script somewhere client-sided for example StarterPack or StarterGui
It is not working either.
It has to be in a local script