You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? I want to make a shop can be useable with cameras.
-
What is the issue? The issue is that I can’t get back to my normal camera after I use the shop. Here is my video: https://gyazo.com/fc3776eb82adda13af1813a04a6f79b1
-
What solutions have you tried so far? Yes I did look for solutions on the forum but I couldn’t find anything related to my question or I don’t know how to ask this issue.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
-- Here is my LocalScript
local waitTime = 5 -- Wait a few seconds before clicking anything.
wait(waitTime)
local maxCamValue = 3 -- This is how many cams are in workspace.
local camValue = script.Cam.Value
lastCam = nil -- This is where the camera is going to move.
local leftArrow = script.Parent.Left
local rightArrow = script.Parent.Right
local cancel = script.Parent.Cancel
local function moveCamera()
local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
lastCam = workspace:FindFirstChild("Cam"..camValue)
for i = 0,1,0.001 do
camera.CFrame = camera.CFrame:Lerp(lastCam.CFrame,i)
wait()
end
end
rightArrow.MouseButton1Down:connect(function()
camValue = camValue + 1
if camValue >= maxCamValue + 1 then
camValue = 1
end
moveCamera()
end)
leftArrow.MouseButton1Down:connect(function()
camValue = camValue - 1
if camValue <= 0 then
camValue = 4
end
moveCamera()
end)
cancel.MouseButton1Down:Connect(function()
camValue = 0
local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Custom
camera.CameraSubject = game.Players.LocalPlayer.Character.Humanoid
end)
I want to know how to get back to my normal camera.
I think I have done something wrong with CFrames.