How would I make it so two screens turn on at once.. and do the same things when activating a button?

I’m currently making a festival and I want to make it so that there are screens that activate and show video. The only thing I’m having an issue with is the script. The screens just don’t load or show video… I’ve tried going through the Video API but haven’t been successful…

Code:

local button = script.Parent
local Screen1 = game.Workspace.Screen1
local Screen2 = game.Workspace.Screen2
local VideoFrame1 = game.Workspace.Screen1.SurfaceGui.VideoFrame
local VideoFrame2 = game.Workspace.Screen2.SurfaceGui.VideoFrame

local function onButtonActivated()
	
	VideoFrame1.IsLoaded = true
	VideoFrame2.IsLoaded = true
	
	VideoFrame1.Looped = true
	VideoFrame2.Looped = true
	
	VideoFrame1.Video = "rbxassetid://5608337069"
	VideoFrame2.Video = "rbxassetid://5608337069"
	wait(5)
	VideoFrame1.Video = "rbxassetid://5608410985"
	VideoFrame2.Video = "rbxassetid://5608410985"
	
end

button.Activated:Connect(onButtonActivated)

The IsLoaded property of Video Frames is read-only which means it can’t be changed using a script. Removing the code that mentions it fixes the issue

local button = script.Parent
local Screen1 = game.Workspace.Screen1
local Screen2 = game.Workspace.Screen2
local VideoFrame1 = game.Workspace.Screen1.SurfaceGui.VideoFrame
local VideoFrame2 = game.Workspace.Screen2.SurfaceGui.VideoFrame

local function onButtonActivated()

    VideoFrame1.Looped = true
    VideoFrame2.Looped = true

    VideoFrame1.Video = "rbxassetid://5608337069"
    VideoFrame2.Video = "rbxassetid://5608337069"
    wait(5)
    VideoFrame1.Video = "rbxassetid://5608410985"
    VideoFrame2.Video = "rbxassetid://5608410985"
	
end

button.Activated:Connect(onButtonActivated)
1 Like

It seems that when pressing the button the screens don’t seem to work still?

Are the video frames marked as playing? You can either do that by just :white_check_mark:ing the Playing property or by adding this to the code:

VideoFrame1.Playing = true
VideoFrame2.Playing = true

Also I’m guessing that the button is either a TextButton or an ImageButton

I’ve already made it so it loops and turns on “Playing”… but I can’t see it still? Maybe it is the ID or Video?

local button = game.Workspace.Panel2.SurfaceGui.Frame2.TextButton2
local Screen1 = game.Workspace.Screen1
local Screen2 = game.Workspace.Screen2
local VideoFrame1 = game.Workspace.Screen1.SurfaceGui.VideoFrame
local VideoFrame2 = game.Workspace.Screen2.SurfaceGui.VideoFrame

local function onButtonActivated()
	VideoFrame1.Looped = true
	VideoFrame2.Looped = true
	
	VideoFrame1.Playing = true
	VideoFrame2.Playing = true
	
	VideoFrame1.Video = "rbxassetid://5608337069"
	VideoFrame2.Video = "rbxassetid://5608337069"
	wait(5)
	VideoFrame1.Video = "rbxassetid://5608410985"
	VideoFrame2.Video = "rbxassetid://5608410985"
	

end

button.Activated:Connect(onButtonActivated)

For some reason Activated doesn’t fire when the button is in a SurfaceGui. I didn’t notice it before because I was using a ClickDetector instead of a TextButton (because it was easier to insert). Replacing Activated with MouseButton1Click fixed the issue for me

local button = game.Workspace.Panel2.SurfaceGui.Frame2.TextButton2
local Screen1 = game.Workspace.Screen1
local Screen2 = game.Workspace.Screen2
local VideoFrame1 = game.Workspace.Screen1.SurfaceGui.VideoFrame
local VideoFrame2 = game.Workspace.Screen2.SurfaceGui.VideoFrame

local function onButtonActivated()
	
	VideoFrame1.Looped = true
	VideoFrame2.Looped = true

	VideoFrame1.Playing = true
	VideoFrame2.Playing = true

	VideoFrame1.Video = "rbxassetid://5608337069"
	VideoFrame2.Video = "rbxassetid://5608337069"
	wait(5)
	VideoFrame1.Video = "rbxassetid://5608410985"
	VideoFrame2.Video = "rbxassetid://5608410985"

end

button.MouseButton1Click:Connect(onButtonActivated)
1 Like