RandomBlox47

Find all children (SurfaceGui)

Jun 5th, 2022 (edited)
1,296
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.13 KB | None | 0 0
  1. -- this script will create parts with an gui containing all childrens name
  2. -- see more of my scripts in https://pastebin.com/u/RandomBlox47/1/zzkM755Y
  3. local children = workspace:GetChildren() -- local of all childrens in workspace, you can change the workspace to anything else
  4. local player = game.Players.EmeraldsOfChaos.Character.Head -- local of the player's head, you can change EmeraldsOfChaos to anything else
  5. for i = 1, #children do -- loops through all parts on the workspace
  6.     local part = Instance.new("Part", workspace) -- creates a new part in workspace
  7.     local gui = Instance.new("SurfaceGui", part) -- creates a surface gui on the part
  8.     gui.Face = "Top" -- sets the surfacegui face to "Top"
  9.     local text = Instance.new("TextLabel", gui) -- creates a textlabel on the gui
  10.     text.Size = UDim2.new(1, 0, 1, 0) -- sets the text size to become full
  11.     text.Text = children[i].Name -- sets the text to the children's name
  12.     text.TextScaled = true -- makes the text scaled
  13.     part.CFrame = CFrame.new(player.Position.X, player.Position.Y, player.Position.Z) -- puts the part position into the players head
  14. end -- ends the loop
Advertisement
Add Comment
Please, Sign In to add comment