Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to stop cutscene from running when skipped?

i would like to know how you could stop code from running you see im trying to add skip buttons to my cutscenes so yeah heres my attempt

local skip = false

wait(3)
if skip == false then
print"doing cutscene"
if skip == false then
wait(2)
if skip == false then
print"wondering camera"
if skip == false then
wait(1)
if skip == false then
print"more cutscene
if skip == false then
wait(10)
if skip == false then
print"Done"
end
end
end
end
end
end
end




script.Parent.skip.MouseButton1Click:Connect(function()
skip = true
end)

this can work but it seems inefficient and makes the code look messy any idea on how i could make this better?

2 comments

0

this isn't the fix to your problem, but I just wanted to say that the print parts won't work because there aren't any parentheses

0

It works without parentheses

2 answers

At line 13 finish ur quotation marks

3 comments

0

.-., You won't help him?

0

The script won’t work if he doesn’t fix his quotation mark lol

0

You are right. lol

Ok, lets try it!

First Step : First of all! We need to know how to use a "Skip" button on a cutscene so we can get our character back [Our camera].

Second Step : We need to know how to use or move the camera, I made an example or how we can make it...

local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable

So now we can move it wherever we want! We can even make a mining simulator shop with that function!

Third Step : We need to know how to make a cutscene! I guess that you already have the script to do that, so lets only skip this step!

Fourth Step : Enjoy coding! You always have to enjoy what are you doing! Play some music while you script or even you can play a game for be relaxed!

Lets get into the code!

--> Locals <--

local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable

local skipV = false

--> Code <--

local function skipF()
	if not skipV then
		wait() --> The seconds that takes your cutscene!
		print("Only testing!")
	end
	skipV = true

	if skipV == true then
		camera.CameraType = Enum.CameraType.Custom
	end
end

--> Connections <--
script.Parent.MouseButton1Click:Connect(skipF)

local warnMessage = "The code is incorrect!"
pcall(warnMessage)

That's all you need! Now we know how to use a "skip" and now we know how to return the camera to the player!

I hope my answer already solve your question! It does please accept my answer! That will help me a lot!

Keep scripting!

This discussion is preserved as it was. New answers, comments, and votes are closed.