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