I need help making a GUI that allows user to input a video ID

Since Roblox recently added the ability to play videos in-game, I need help making a control GUI that works like a music one (input the ID and it plays for everyone in the server) that allows a user to pick a video ID and it plays on a VideoFrame for everyone in the severe.

3 Likes

Please try to accomplish this yourself and post if you’re stuck on any step of the way after having debugged, read documentation and done what you can. This category is not for handing out free code. It would be much appreciated if you tried yourself first.

3 Likes

Hiwiwi!
I agree with colbert2677. Try to do it for urself first. Here’s a procedure:

1- Place a ScreenGui inside StarterGui
2- Place a Frame inside the ScreenGui
3- Place a TextBox and a TextButton inside the Frame
4- Place a LocalScript inside ScreenGui

5- Place a Part on Workspace
6- Place a SurfaceGui inside the Part
7- Place a VideoFrame inside the SurfaceGui
8- Place a Script inside the Part

9- Create a Remote Event inside ReplicatedStorage

In the LocalScript inside StarterGui you shoud add

1- Remote Events to handle comunication between Client and Server scripts, be sure to name your Remote Event correctly inside ReplicatedStorage, I called mine TVplay

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local tvPlay = ReplicatedStorage:WaitForChild("TVplay")

2- Instance your GUI components

local tvFrame = script.Parent.Frame
local playButt = tvFrame.TextButton
local vidIDbox = tvFrame.TextBox

3- Function to send the content of the ID box to the Server Script in Main Part

local function getVid()
    tvPlay:FireServer(vidIDbox.text)
end
playButt.MouseButton1Click:Connect(getVid)

In the Script inside the Main Part you should listen the LocalScript event, exactly like u did in the LocalScript:

1- Remote Events to handle comunication between Client and Server scripts

2- Instance ur VideoFrame

local vidFrame = script.Parent.SurfaceGui.VideoFrame

3- A function to handle the Remote Event, get the ID sent from Client, and add it into the VideoFrame

local function vidPlay(player, vidID)
    vidFrame.Video = "rbxassetid://" .. vidID
    vidFrame.Looped = true
    vidFrame:Play()
end
tvPlay.OnServerEvent:Connect(vidPlay)
2 Likes

Also you can pcall the function if you know what that is to make it make sure the video is a real video.

2 Likes

Totally true! :3
Lets not rush and add our pcalls xD

2 Likes

I made something similar in Python, but I can’t translate it into Lua and figure out how to tie it into the video frame (make it work)

Yup, well, the answer I gave you cover all the basics with using the VideoFrame and getting and sending values from Client to Server, you wont have any problems if u already know Python.
So it was helpful?

1 Like

yep. Thanks for the help. It helped me a lot

1 Like