realOmlet
(Omlet)
January 20, 2023, 5:10pm
#1
I’m trying to make a TV where Roblox videos randomly cycle however after 1-5 videos it always freezes and gets stuck permamently.
local videoFrame = game.Workspace["Meshes/1_SM_TV7"].SurfaceGui["Ocean Coastline"]
local Videos = {"rbxassetid://5608268502:", "rbxassetid://5670802294", "rbxassetid://5608321996", "rbxassetid://5608410985",
"rbxassetid://5608360493", "rbxassetid://5670824523", "rbxassetid://5608327482", "rbxassetid://5608359401",
"rbxassetid://5670809466", "rbxassetid://5608403837", "rbxassetid://5608333583", "rbxassetid://5608369138",
"rbxassetid://5608349310"}
videoFrame.Looped = false
videoFrame.Volume = 0
local currentVideo = game.ReplicatedStorage.CurrentVideo
while true do
randomVideo = math.random(1,#Videos)
currentVideo.Value = "..."
task.wait()
currentVideo.Value = Videos[randomVideo]
videoFrame.Video = currentVideo.Value
videoFrame.Playing = true
while not videoFrame.IsLoaded do
task.wait()
end
videoFrame:Play()
videoFrame.Ended:Wait()
end```
Accoast
(Accoast)
January 20, 2023, 5:23pm
#2
Instead of waiting for the video’s Ended
connection to activate try waiting for the video to end manually, by getting video length using videoFrame.TimeLength
:
-- videoFrame.Ended:Wait()
task.wait(videoFrame.TimeLength)
1 Like
realOmlet
(Omlet)
January 20, 2023, 5:24pm
#3
Sadly this didn’t work either + I was looking for a way to automate this since there’s around 20 videos and I want to add more
Accoast
(Accoast)
January 20, 2023, 5:31pm
#4
It’s very strange that it didn’t work for you.
The Ended
connection didn’t work for every video i tried, but manual waiting worked on my place when it was playing arsenal videos.
The script’s logic seems alright, but i don’t understand the meaning of setting Playing
to true and the activating :Play()
three lines after that.
Btw some videos are not loading at all for me.
Maybe one of your videos is not loading? You have a loop to wait for something to load, maybe it’s getting stuck there.
realOmlet
(Omlet)
January 20, 2023, 6:09pm
#6
The thing is that it happens way too often. Like 3/4 of the vids would have to not load if that’s the case.