-
What do you want to achieve? I want something like this:
I made this, using CameraType.Attach but it gives me another problem, the player is able to rotate the camera holding right click.
-
What is the issue? The code I use doesnt work at all.
-
What solutions have you tried so far? I tried diferent cameraTypes, they also gives me another problem, the player is able to rotate the camera pressing right click.
Sorry if the code is really bad…
--This is the code that uses cameraType.Attach--
wait(1)
local UserInputService = game:GetService("UserInputService")
local player = game.Players.LocalPlayer
local rotating = false--I put rotating instead of moving for some reason xd
local camera = game.Workspace.CurrentCamera
local tween = nil
UserInputService.InputBegan:Connect(function(input,gameProccesedEvent)
if input.KeyCode == Enum.KeyCode.A or input.KeyCode == Enum.KeyCode.Left then
rotating = true
while rotating == true and game.Workspace.CameraPart.Position.X <= -16 do
local cosa = game.Workspace.CameraPart.Position
local EndPos = Vector3.new(cosa.X + 0.3, cosa.Y, cosa.Z)
local Tweeninfo = TweenInfo.new(0.05, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0)
local End = {Position = EndPos}
tween = game:GetService("TweenService"):Create(game.Workspace.CameraPart, Tweeninfo, End)
tween:Play()
camera.CameraType = Enum.CameraType.Attach
camera.CameraSubject= game.Workspace.CameraPart
wait(0.01)
end
end
end)
UserInputService.InputEnded:Connect(function(input,gameProccesedEvent)
if input.KeyCode == Enum.KeyCode.A or input.KeyCode == Enum.KeyCode.Left then
rotating = false
end
end)