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!
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.
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
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?
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!
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