Hello, Everybody, I am currently working on a horror game inspired by piggy but as you know when you join 'piggy' there is a menu Gui with a shop and play buttons when you click 'play" the background moves forward and rotates a bit, I am trying to replicate that camera movement I heard you need a CFrame and a camera tweening scripts, so I gave it a shot, I made 2 parts in workspace called 'PartA' and 'PartB' and they are both plastic and have a hinge front surface so I made a local script in starterGui and made this script inside it

wait(1) --how much time it takes when the game starts
local TweenService = game:GetService("TweenService")
local Camera = game.Workspace.CurrentCamera

local function MoveCamera(StartPart, EndPart, Duration, EasingStyle, EasingDirection)
	Camera.CameraType = Enum.CameraType.Scriptable
	Camera.CFrame = StartPart.CFrame
	local Cutscene = TweenService:Create(Camera, TweenInfo.new(Duration, EasingStyle, EasingDirection), {CFrame = EndPart.CFrame})
	Cutscene:Play()
	wait(Duration)
end

local function Cutscene()
	MoveCamera(game.Workspace.PartA, game.Workspace.PartB, 1.5, Enum.EasingStyle.Linear, Enum.EasingDirection.Out)
	
	wait(5) --How much time the second camera waits until its closed
	Camera.CameraType = Enum.CameraType.Custom
	Camera.CameraSubject = game.Players.LocalPlayer.Character:WaitForChild("Humanoid")
end

Cutscene()

but the problem is when you start the game after like 1 second the camera movement starts without the player's request [automatically] I need a ScreenGui that is stuck at PartA and when the play button is pressed the movement continues to PartB Thanks

3 comments

0

It starts automatically because you literally call the function after you wait 1 second.

0

Give me the path to the button and I can change this so it works when the button is clicked.

0

Sorry for the delay, The button location is StarterGui>Camera>Play