generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Table help (Might be something else; I'm not entirely sure.)

Previous Thread :: Next Thread 
SirCupcakez is not online. SirCupcakez
Joined: 10 Dec 2013
Total Posts: 17
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 is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image