I tried many times many way's but it isn't working? Could somone help?
It's all in a GUI but i did this quick it's not complete
Localscript:
local targetname = target.Parent.Name
script.Parent.Target:FireServer(targetname)
ServerScipt
script.Parent.Target.OnServerEvent:Connect(function(player, targetname)
script.Parent.Username.Value = targetname
end)

14 comments
you need to put player in the arguments of the serverscript, OnServerEvent
and the other parameter should be after the player too
Nope
What is the parent of your script, local script, and event? I bet the error is either the scripts being parented incorrectly or that the Value is not a StringValue
If u see they are good parented?
The parent is a frame
The parent of the script and event is a frame?
Yea
Move the event to replicated storage and move the script to serverscriptservice
Okey
Not working to
What went wrong? You will obviously need to adjust your variables if you haven't done so already
Server scripts don't run in PlayerGui in a server. They will with Play Solo though. As mentioned by Vulkarin, move the objects, and make sure the "Username" object is accessible by both script types, preferably in Workspace or ReplicatedStorage
Bu i need a value for every player that’s a cop so that will not work when 2 players need to bebarrested