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

Is there a way to get the name of a player who clicked a ScreenGui? [SOLVED]

Basically, I have this gui that is pretty much a chat system, has 5 lines of text for people to use, but what I want it to do is to get the person who sent the message's username. It will then output this plus the text they sent (I can do that part).

Here's my script so far:

local server = game.Workspace.Server.server.SurfaceGui
local GUI = script.Parent.Parent
local plyr = game.Players.LocalPlayer --- not sure how but this is where the name will be

script.Parent.MouseButton1Down:connect(function()
	server.line1.Text = plyr.. GUI.inp.Text
end)

Thanks for any help.

1 answer

Don't worry all! I found the answer!

local server = game.Workspace.Server.server.SurfaceGui
local GUI = script.Parent.Parent
local plyr = game.Players.LocalPlayer

script.Parent.MouseButton1Down:connect(function()
	server.line1.Text = plyr.Name..GUI.inp.Text
end)

There you go!

2 comments

0

XD I was going to help you XD

0

Thanks anyways :)

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