I want a image button to be clicked, and when this happens, the camera position will keep changing when ever you click it, its hard to explain ur have to see the code, please help

script.Parent.MouseButton1Click:Connect(function()
	local plr = game.Players.LocalPlayer
    local cam = workspace.CurrentCamera
    local char = plr.Character

	if cam.CFrame == workspace.LifeJacketShop.ShopCameras.ShopCam1 then
    	repeat wait()
        cam.CameraType = Enum.CameraType.Scriptable
    	until cam.CameraType == Enum.CameraType.Scriptable
		cam.CFrame = workspace.LifeJacketShop.ShopCameras.ShopCam2
	elseif cam.CFrame == workspace.LifeJacketShop.ShopCameras.ShopCam2 then
		repeat wait()
        cam.CameraType = Enum.CameraType.Scriptable
    	until cam.CameraType == Enum.CameraType.Scriptable
		cam.CFrame = workspace.LifeJacketShop.ShopCameras.ShopCam3
	elseif cam.CFrame == workspace.LifeJacketShop.ShopCameras.ShopCam3 then
		repeat wait()
        cam.CameraType = Enum.CameraType.Scriptable
    	until cam.CameraType == Enum.CameraType.Scriptable
		cam.CFrame = workspace.LifeJacketShop.ShopCameras.ShopCam4
	elseif cam.CFrame == workspace.LifeJacketShop.ShopCameras.ShopCam4 then
		repeat wait()
        cam.CameraType = Enum.CameraType.Scriptable
    	until cam.CameraType == Enum.CameraType.Scriptable
		cam.CFrame = workspace.LifeJacketShop.ShopCameras.ShopCam5
	elseif cam.CFrame == workspace.LifeJacketShop.ShopCameras.ShopCam5 then
		repeat wait()
        cam.CameraType = Enum.CameraType.Scriptable
    	until cam.CameraType == Enum.CameraType.Scriptable
		cam.CFrame = workspace.LifeJacketShop.ShopCameras.ShopCam6
	end
end)

its a local script in a image button

1 comment

0

NVM fixed it LMAO