Hey there!
I'm currently working on a SurfaceGUI. I don't want others to mess with it. So, I followed this way;
script.Parent.MouseButton1Click:connect(function() if game.Players.LocalPlayer.Name == game.workspace.Part.SurfaceGui.Welcome.TextLabel.Text -- I'm trying to make sure that person who logged into my register is the same person that is going to sign out. then script.Parent.Parent.Welcome.TextLabel.Text = "CLICK TO START WORKING" else game.Players.LocalPlayer:kick("Test") --My problem is here, is this statement right? If any one else press the "SIGN OUT" button they will get a kick. end end) script.Parent.MouseButton1Click:connect(function() --Ignore this part, some frames I did... script.Parent.Parent.TextButton.Visible = true script.Parent.Parent.TextButton.Active = true script.Parent.Parent.TextButton.BackgroundTransparency = 0 end) script.Parent.MouseButton1Click:connect(function() script.Parent.Active = false script.Parent.Visible = false script.Parent.BackgroundTransparency = 1 script.Parent.Parent.takeorder.Visible = false script.Parent.Parent.takeorder.Active = false script.Parent.Parent.takeorder.BackgroundTransparency = 1 end)
So, I want to know if is it correct to say that in a script statement (8th line). Is there any other way to represent the Local Player.
My intention is to give the player a variable as
X = The player who logged into the register. Y = Any other player who tried to log out.
I tried to do it by assigning the Logged player and got his/her username then printed into my text label, then I made a statement like game.Players.LocalPlayer.Name == game.workspace.part.SurfaceGui.Welcome.TextLabel.Text
If you're free to share, is there any other commands inside Roblox studio to get the name of the logged user and store it as a variable.
Thank you.
I think i know what you mean. If you are trying to make a way to know the Name of the Player. You could try putting the name of it in a StringValue and then when you need to access it. Do this
local Player = game.Workspace.Folder.PlayerLoggedIn.Value