Hello, Im making a shop for my game and i cant seem to get the camera cframe go back to the previous cframe when clicked? [Script]: local button = game:GetService(“Players”).LocalPlayer.PlayerGui.StoreNPC.Frame.Back
local cam = game.Workspace.Camera
local Cameras = { – cameras
[“partCFrame”] = game.Workspace.ShopCFrame.CFrame1,
[“partCFrame2”] = game.Workspace.ShopCFrame.CFrame2,
[“partCFrame3”] = game.Workspace.ShopCFrame.CFrame3,
[“partCFrame4”] = game.Workspace.ShopCFrame.CFrame4,
}
local PCFrame = nil – suppose to be the previous cframe
button.MouseButton1Click:Connect(function()
cam.CameraType = Enum.CameraType.Scriptable
for i, v in pairs(Cameras) do – going thru the cameras
if cam.CFrame == v.CFrame and PCFrame ~= cam.CFrame then
PCFrame = cam.CFrame
cam.CFrame = PCFrame
print(v)
end
end
end)
while wait(0.1) do
if cam.CFrame == Cameras.partCFrame.CFrame then
– checking if cam.cframe is equal to the first cframe(partCFrame)
button.Visible = false
else
button.Visible = true
end
end