How to make VideoFrame work on a buttonpress

Hello!

I just downloaded the VideoFrame and am making it for a preshow video and i am wondering how to make the script with the button separate from the screen please help!

5 Likes

Hello, VideoFrames have 2 main functions, Pause and Play. If you want to hook the video frame up to a button, you could use something like this (please read the comments to understand the code):

-- In this, you would have a part named "Button" with a click detector inside that is in the workspace
-- You would also have a part named "Screen" that had a billboard GUI with a video frame

local buttonPart = game.Workspace.Button -- defines the button part
local clickDetector = buttonPart.ClickDetector -- defines click detector
local screen = game.Workspace.Screen -- defines the screen part
local videoFrame = screen.VideoFrame -- defines the video frame

clickDetector.MouseClick:Connect(function(player) -- creates an event to tell when the button is clicked
	if videoFrame.Playing == false then -- checks if the video is not playing
		videoFrame:Play() -- if it is not playing, then play the video
	else -- otherwise,
		videoFrame:Pause() -- pause the video if it was already playing
	end
end)

Hope this could help!

5 Likes

Hey man, how about script where you can change the video after it finishes playing? I mean After video A is finished then video B gonna start playing, By the way also a button where you can skip what is currently playing

It gonna be useful for me since I gonna use all video frame in the catalogue for my TV :smiley: