SurfaceGUI to clone onto a brick

Good morning/afternoon/evening!
I am currently working on making a TV with SurfaceGUIs, and in order to roll out updates easily to each TV, I would like it to clone a SurfaceGUI from somewhere like ServerStorage. This is so I only have to edit it once, and it will go onto each tv!

I can think of a little code, but I am unsure on to how to make it clone onto the certain block. The script that will be executing this code is located inside the same part I want the GUI to be on

local tv = game.ServerStorage.TV

tv:Clone()

end

That is the basis I know, but I think it would just clone itself into ServerStorage again. Any help on this would be greatly appreciated, thanks! :slight_smile:

1 Like

Can’t you simply change the picture that the surface ImageLabels display?

local Tv = game.ServerStorage.Tv

Tv:Clone().Parent = Block

This might help

1 Like

No. Its an interactive TV, with buttons and such.

You can use the Adornee property. Basically, it will shift the SurfaceGUI to the specific part.

Would this work on multiple TV’s? Im making it for a hotel, so there would be a tv in each room, which I dont want to manually have to copy and paste the new one each time.

If you want to script multiple TVs but only change one script, you can use the CollectionService.

Yeah, but is there not a simple way that upon game startup, it will just clone that SurfaceGUI into every block I put the script in?

You can use a loop to attach a SurfaceGUI to a specific part.

Ok, thanks, but I am unsure on how to do that? I was thinking more along the lines of this, but im not sure how to get it to clone into the part instead of just cloning itself

local Tv = game.ServerStorage.TV
Tv:Clone()
for _,part in pairs(GroupOfParts) do
    local TV = game.ServerStorage.TV:Clone()
    TV.Parent = part
end

I really appreciate your help here, but doesnt that mean that all the parts I want the GUI to be on have to be in a group? It would be easier for moving and thinks like that if I could just have it inside the part, what would I need to change in this script for that to happen?

Would it not hurt to just attach the surface GUI in the TV and just clone the TV itself then parent it?

Hmmmm. I could, but I plan to update this constantly with relevant information, and when there’s going to be 30+ rooms, its a massive pain to ensure they are in the correct place, and just duplicating them would get very repetitive. Is there no way I can just clone it into each part I put the script in? I made a part that displays a GUI on the players screen when they touch it, but that wont work for this instance.

local GUI = game.ServerStorage.LiftGUI
if GUI.Frame.Visible == false
	then GUI.Frame.Visible =  true
		end
	
		
script.Parent.Touched:Connect(function(hit)
	
if hit.Parent and game.Players:FindFirstChild(hit.Parent.Name) then
  local plr = game.Players[hit.Parent.Name]
if plr:FindFirstChild("PlayerGui") and not plr.PlayerGui:FindFirstChild(GUI.Name) then
   GUI:Clone().Parent = plr.PlayerGui

plr.PlayerGui.LiftGui.Enabled = not plr.PlayerGui.LiftGui.Enabled


 end
end
end)

This is specifying where to clone the GUI, but I am unsure on how to make this clone into the part, and how to apply it for a SurafceGUI instead. Still, any help would be incredible, I am incredibly stuck with this! :slight_smile:

If anyone else knows how to do it, that would be greatly appreciated!

Just tried this, the code that actually works is:

local TV = game.ServerStorage.TV -- Where the SurfaceGUI is located, in this case in ServerStorage
TV:Clone().Parent = script.Parent -- referencing the part that the GUI needs to go into

Thanks for the base code @EHGTR1903

1 Like