Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Creating something in the LocalPlayer's PlayerGui?

I want to create a TextBox inside a Screengui that I have in the Player's PlayerGui. However, when I run this LocalScript:

Sgui = game.Players.LocalPlayer.PlayerGui.Chat
Txt = Instance.new("TextBox", Sgui)

Noting happens. I had a similar problem to this earlier, and I was advised to use a Script instead of a LocalScript (although I'm not sure why), and it worked. But this time I can't use a normal script because I don't know how to reference the correct Player without using LocalPlayer.

So what is wrong and what do I do?

3 comments

0

When is this supposed to run? When the game starts?

0

You need to sent the position and size of the textbox.

0

This script is disabled and another script un-disables it. I don't need to set the size and position to make it create in the player's GUI.

1 answer

--[[LOCALSCRIPT]]--

local localplayer=game:GetService('Players').LocalPlayer
local playergui=localplayer:findFirstChild('PlayerGui')

--Boom Gui Done. THUMBS UP! ;D

This discussion is preserved as it was. New answers, comments, and votes are closed.