|
| 19 Jan 2016 08:12 PM |
-- I'm relativly new to using tables so I think that is the part I messed up on. This script is meant to take a host player's screen gui and put it on a surface -- gui that updates whenever the player changes his/her gui. (aka dragging textboxes so far).
frame = script.Parent.Frame.Frame board = workspace:FindFirstChild("board101gui",true) textframe1 = script.textframe:Clone() textframes = frame.Parent.textframes frames = {} framekey = 1
function UpdateBoard() -- Sends updated information to the board (Surface gui) if board:FindFirstChild(framekey,true) == nil and ready == true then textframe1.Name = framekey textframe1.Parent = board elseif ready == true then for _,tframe1 in pairs (board:GetChildren()) do if tframe1.ClassName == "Frame" then tframe1.Position = UDim2.new(frames[tframe1.Name]) -- For some reason this asigns the Position {0,0},{0,0}. end end end end
frame.ptextframe.MouseButton1Click:connect(function() -- When the host adds a new textframe (textbox) it asigns a key and value to it and sends it to the UpdateBoard ready = true local textframe = script.textframe:Clone() textframe.Parent = textframes textframe.Name = framekey table.insert(frames, framekey, textframe.Position) UpdateBoard() UpdateFrame() framekey = framekey + 1 end)
function UpdateFrame() for _,tframe in pairs (textframes:GetChildren()) do -- When any textframe moves it sends updated information to the UpdateBoard tframe.Changed:connect(function() frames[tframe.Name] = tframe.Position UpdateBoard() end) end end
|
|
|
| Report Abuse |
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 19 Jan 2016 08:14 PM |
| Just remember you can always move guis up or down a list with Position = UDim2.new(x,0,y*i,0) for example, i would be the number of guis already in the list |
|
|
| Report Abuse |
|