I've got an admin gui in my game, admins have to type a players name in, then press confirm to set that player as the one that is affected. The issue is that in filtering enabled, I don't know how to set the player value to what the text is. This is what I tried:
script.ConfirmPlayer.OnServerEvent:Connect(function(Player) if Player.Name == "soutpansa" or Player.Name == "WakaFlockajr" or Player.Name == "Night_Moons" or Player.Name == "bigbus92" or Player.Name == "Shirou_XI" then script.PlayerValue.Value = Player.PlayerGui.MainHud.ControlPanel.Person.Text end end)
A local script fires the event from the gui. I'm not sure what else to try here in order to set the PlayerValue.
Thanks for reading
Edit: Server script:
local DoPlayer = script.ConfirmPlayer
function DoPlayer.OnServerInvoke(Player) if Player.Name == "soutpansa" or Player.Name == "WakaFlockajr" or Player.Name == "Night_Moons" or Player.Name == "bigbus92" or Player.Name == "Shirou_XI" then script.PlayerValue.Value = Player:FindFirstChild("PlayerGui"):FindFirstChild("MainHud").ControlPanel.Person.Text end end
(I know im supposed to return something here, but idk what)
local script:
wait(1) local Player = game.Players.LocalPlayer script.Parent.MouseButton1Click:Connect(function() local Name = script.Parent.Parent.Person.Text Player.Backpack.Control_Panel.ConfirmPlayer:InvokeServer() end)
You cannot access a PlayerGui using a server script on the server. Instead, you could just either fire another RemoteEvent or you can use RemoteFunctions to retrieve the text of the client and then return the text which then you can set the value of 'script.PlayerValue.Value' to that.
Here is a helpful article on this: http://robloxdev.com/articles/Remote-Functions-and-Events