Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 9 years ago

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

Log in to vote
0
Answered by 9 years ago

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!

0
XD I was going to help you XD EzraNehemiah_TF2 3552 — 9y
0
Thanks anyways :) jamesbiggsbot 0 — 9y
Ad

Answer this question