local DemoNotice = script.Parent.DemoNoitice
local button = DemoNotice.Play
local SFX = script.Parent.Sounds
local ButtonHoverSound = SFX.ButtonHover
local ButtonPressed = SFX.ButtonPressed
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Camera = workspace.CurrentCamera
local MenuMusic = SFX.Music
MenuMusic:Play()
local StopCam = false


local mouse = game.Players.LocalPlayer:GetMouse()
mouse.Icon = "http://www.roblox.com/asset?id=6023982432"

local function MouseHover()
	ButtonHoverSound:Play()
end

local function Play()
	ButtonPressed:Play()
	DemoNotice.Visible = false
	MenuMusic:Stop()
	Camera.CameraType = Enum.CameraType.Custom
	StopCam = true
end

button.MouseEnter:Connect(MouseHover)

button.MouseButton1Click:Connect(Play)


local Cameras = workspace:WaitForChild("Cameras")	
local CameraPart1 = Cameras:WaitForChild("Camera1")
local CameraPart2 = Cameras:WaitForChild("Camera2")
local CameraPart3 = Cameras:WaitForChild("Camera3")
local CameraPart4 = Cameras:WaitForChild("Camera4")



repeat wait()
	Camera.CameraType = Enum.CameraType.Scriptable
until Camera.CameraType == Enum.CameraType.Scriptable
Camera.CFrame = workspace.Cameras.Camera1.CFrame

while true do
		for num = 0,1,.001 do
			if StopCam == false then
		Camera.CFrame = CameraPart1.CFrame:lerp(CameraPart2.CFrame,num)
		game:GetService("RunService").RenderStepped:Wait()
		end
		end

	for num = 0,1,.001 do
		if StopCam == false then
		Camera.CFrame = CameraPart2.CFrame:lerp(CameraPart3.CFrame,num)
		game:GetService("RunService").RenderStepped:Wait()
	end
	end
	
	for num = 0,1,.001 do
		if StopCam == false then
		Camera.CFrame = CameraPart3.CFrame:lerp(CameraPart4.CFrame,num)
		game:GetService("RunService").RenderStepped:Wait()
		end
		end
	for num = 0,1,.001 do
		if StopCam == false then
		Camera.CFrame = CameraPart4.CFrame:lerp(CameraPart1.CFrame,num)
		game:GetService("RunService").RenderStepped:Wait()
		end
	end
	end
	end

The camera stop script wich i have done trought a if value makes the script lag when u press play your game almost crashes and it laggys out us there a fix for this?

3 comments

0

Maybe tween the camera?

0

Yeah, while true do loops and repeats can seriously lag your game a tween would proabably be a good replacement,

0

its only when u press play aka it stops the loop