How can I make a part activated cutscene?

In my game, if you step on a special part, it plays a cutscene. How can I do this?

4 Likes

In my game I used a text button, but its the same principle, what you will need to do is add an event

part.Touched:Connect(function(HIT) – “Part” as in the part you want to be touched
local H = HIT.Parent:FindFirstChild(“Humanoid”)
if H then
(Insert cut-scene script here)
end

end)

1 Like
wait(3)
local TweenService = game:GetService("TweenService") -- tween Service 
local Camera = game.Workspace.CurrentCamera


local function MoveCamera(StartPart, EndPart, Duration, EasingStyle, EasingDirection) -- buch of cades for making the cutscene
	Camera.CameraType = Enum.CameraType.Scriptable -- changing camera type to scriptable
	Camera.CFrame = StartPart.CFrame 
	local Cutscene = TweenService:Create(Camera, TweenInfo.new(Duration, EasingStyle, EasingDirection), {CFrame = EndPart.CFrame}) -- making the custom tween info
	Cutscene:Play()
	wait(Duration) -- the duration
end

local function Cutscene()
	MoveCamera(game.Workspace.PartA, game.Workspace.PartB, 1.5, Enum.EasingStyle.Bounce, Enum.EasingDirection.Out) -- This is the the part where you change the easing style, dirextion, which part should the cutscene start at, the duration of the cutscene and the the part where the cutscene ends
	wait(1.5)
	MoveCamera(game.Workspace.PartC, game.Workspace.PartD, 1.5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
	
	wait(.5)
	Camera.CameraType = Enum.CameraType.Custom
	Camera.CameraSubject = game.Players.LocalPlayer.Character:WaitForChild("Humanoid")
end

If you want it to be functioned when a part is touched then -

game.Workspace.Part.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		Cutscene() -- play's the cutscene
	end
end)

If you want it to be fired by a remote event then -

game.ReplicatedStorage.Cutscene.OnClientEvent:Connect(function()
	Cutscene()
end)

Now inside a ServerScript -

game.ReplicatedStorage.Cutscene:FireClient() -- fires this to one person
3 Likes

How do you get all the code like that do you just copy and paste from studio?

1 Like

Here’s an example:

local part = script.Parent;

local function on_Touch(hit)

      if hit.Parent:FindFirstChildOfClass("Humanoid") ~= nil then
       
          --Code to run when fired.
      end
end

part.Touched:Connect(on_Touch)

I typed it in Studio after that I copied and pasted it

1 Like

thank you everybody, you were all very helpful.

3 Likes

Thanks I will know next time to do that instead of typing it all up on here.

1 Like