Camera/Player manipulation help [Script]

  1. What do you want to achieve?
    Hello, I am trying to make a script that combines the following information:
    -The player can’t manipulate the camera
    -The camera follows the player
    -The camera always stays behind the player’s back
    -The character moves forward all the time and can only move in 90 degrees rotation according to a button he clicks on.
    I put below the script started to realize but I am completely blocked it’s difficult. Sorry if the script i put is a bit long. Thanks

  2. What is the issue?

print("PLAYER CAN'T HAVE INTERACTION WITH CAMERA OK !")
local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable

print("PLAYER RUN EVERYTIME OK!")
RunService.RenderStepped:Connect(function()
	character.Humanoid:Move(Vector3.new(0,0,-1), true)
end)

print("CAMERA FOLLOW PLAYER BUT I THINK IT'S NOT GREAT")
RunService.RenderStepped:Connect(function(step)
	Timer += step
	if Timer >= TimerMax then
		Timer = 0
		local goal = {CFrame = root.CFrame * CFrame.Angles(math.rad(-40),0,0) + Vector3.new(0,10,7)}
		local tweenservice = game:GetService("TweenService")
		local tweeninfo = TweenInfo.new(0.5, Enum.EasingStyle.Linear, Enum.EasingDirection.In, 0)
		local tween = tweenservice:Create(camera, tweeninfo, goal)
		tween:Play()			
	end
end)

print("THIS PART NOT WORK, BUTTON WORK BUT NOT FUNCTION INSIDE, FOR PLR MOVE")
plr.PlayerGui.ScreenGui.Move.Left.MouseEnter:Connect(function()
	print("gauche")
	plr.PlayerGui.ScreenGui.Move.Visible = false
	camera.CFrame *= CFrame.Angles(0, math.rad(80), 0)
end)

plr.PlayerGui.ScreenGui.Move.Right.MouseEnter:Connect(function()
	print("droite")
	plr.PlayerGui.ScreenGui.Move.Visible = false
	camera.CFrame *= CFrame.Angles(0, math.rad(-80), 0)
end)

1 Like

I’m doing a short video to show you what happen with my current script

Here is the video : As you can see the movement of the camera is extremely bad which does not allow the character to change direction well

I keep trying to improve the script but I can’t find a way out. If anyone knows of a solution i’m interested