No output and not getting player

hello there, i made an case battle system, please see the last post if u dont get me.
The problem is, that the player info is not getting replicated into the gui.

heres the script.

local rep = game:WaitForChild("ReplicatedStorage")
local caseBattlesFolder = game:WaitForChild("ReplicatedStorage"):WaitForChild("caseBattles")


caseBattlesFolder.createCaseBattleBlue.OnServerEvent:Connect(function(Server, Dictionary, Client) -- Defining "Client" as the local player who created the game. Dont mind dictionary. Therefore defining "Server" as all players in the game
	local returned = false
	local template = game.StarterGui.UI.Dashboard.TextLabel.CaseBattles.ScrollingFrame.Template:Clone() -- Telling the server that a new game has been created and creating a new frame to inform people
	template.Visible = true
	template.Parent = Server.PlayerGui.UI.Dashboard.TextLabel.CaseBattles.ScrollingFrame
	template.ImageLabel.Image = "rbxassetid://10910715327" -- Changing imagelabel to the hosts case selection.
	template.ImageLabel.TextLabel.Text = "Host: "..Client.Name -- Setting Text as the Host from CLIENT.Name
	wait(0.01)
	local newVal = Instance.new("StringValue") -- Creating a new value to check which button the player has clicked, it could be that another player created the game and player clicked other button and it would show up at both guis as client and the other one. Well we dont want this so were defining this.
	newVal.Name = "USERDATA" -- Naming the value
	newVal.Value = Client.Name -- Setting as the Name of client
	newVal.Parent = template.ImageLabel.TextButton -- Parenting it into all player guis
	local reservedForClient = game.ServerStorage.CaseBattle:Clone() -- main case battle gui, reserving for client
	reservedForClient.Parent = Client.PlayerGui
	local reservedForPlayer = game.ServerStorage.CaseBattle:Clone() -- main case battle gui, reserving for expected player
		caseBattlesFolder.otherPLR.joinCaseBattle.OnServerEvent:Wait(function(Server, Val, expectedPLR)
			if Val.Value == newVal.Value then -- checking if the player has clicked our game by the value seen at the upper line
			print("returned = true") -- printing
				returned = true -- changing returned to true, so we get the response
				print(expectedPLR)
			reservedForPlayer.Parent = expectedPLR.PlayerGui -- setting the gui reserved for expected player to expected player
			local image = game.Players:GetUserThumbnailAsync(expectedPLR.UserId, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size420x420) -- changing image to thumbnail of expected player
			reservedForClient.Main.Content.secPLR.Image = image -- setting it as the expected plr profile picture
			reservedForClient.Main.Content.callBot.Visible = false -- disabling the call bot button
			reservedForPlayer.Main.Content.secPLR.Image = image -- the same just for the client
				reservedForPlayer.Main.Content.callBot.Visible = false -- the same just for the client
				wait(2) -- delay
				warn("Case battle starting") -- Response sucessful and the battle starts now.
			else
			print("Test123") -- printing this as a test.
			end
		end)
end)

and this for the local script when u click join.

local expected = game.Players.LocalPlayer
	script.Parent.MouseButton1Click:Connect(function()
		if script.Parent:FindFirstChild("USERDATA") then
			script.Parent.Text = "Connecting.."
			game.ReplicatedStorage.caseBattles.otherPLR.joinCaseBattle:FireServer(script.Parent:FindFirstChild("USERDATA").Value, expected)
		else
			error("// ZFLIP CLIENT ERROR -- ERROR 404 NOT FOUND //") -- just errors because it didnt find a value
		end
end)	

When i click it it keeps saying connecting and it doenst print out anything.

Basically, i just want to create a variable for the player and i wanna replicate it through this gui:

When clicked, it will notify that the player joined, now its gonna create a variable for the player and it will also show the info on these placeHolders!

Could anyone help? Thanks!

This could possibly be the problem, the first argument is defined. So you don’t need to define the first variable.

Currently this is what the server is receiving

This is what the server is recieving

(LocalPlayer, script.Parent:FindFirstChild("USERDATA").Value, LocalPlayer)

The first argument is already defined, so try this:
Server

caseBattlesFolder.otherPLR.joinCaseBattle.OnServerEvent:Wait(function(expectedPLR, value) -- value here is script.Parent:FindFirstChild("USERDATA").Value

Client

game.ReplicatedStorage.caseBattles.otherPLR.joinCaseBattle:FireServer(script.Parent:FindFirstChild("USERDATA").Value)

also try print(expectedPLR.Name)
Sorry if I read something wrong I got confused a bit

Hi again!

caseBattlesFolder.otherPLR.joinCaseBattle.OnServerEvent:Wait(function(Server, Val, expectedPLR)

When I recommended using :Wait it was to wait for one player is that true? you only want one player to join a lobby? If so here is how to use :Wait

local Server, Val, expectedPLR = caseBattlesFolder.otherPLR.joinCaseBattle.OnServerEvent:Wait()
-- wait stops the script and *returns* values received, it does not run a connected function.

if Val.Value == newVal.Value then
	print("returned = true")
	returned = true
	print(expectedPLR)
	reservedForPlayer.Parent = expectedPLR.PlayerGui
	local image = game.Players:GetUserThumbnailAsync(expectedPLR.UserId, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size420x420)
	reservedForClient.Main.Content.secPLR.Image = image
	reservedForClient.Main.Content.callBot.Visible = false
	reservedForPlayer.Main.Content.secPLR.Image = image
	reservedForPlayer.Main.Content.callBot.Visible = false
	task.wait(2)
	warn("Case battle starting")
else
	print("Test123")
end

oh wait I didn’t see the :wait() that’s my bad . use :Connect(Function() in this case.

Also you I recommend you to make a folder and put USERDATA in that folder. Make an intvalue for the amount of players. And every time a player successfully joins you update the value by adding one.

my bad x2 I thought this was the OP

This does not work.
Screenshot_74
It prints unknown, and the gui doenst show!

Does it print anything in the output logs? I have a feeling “Host: unkown” is a different issue earlier in the server script. Try just using the Server variable from now on, as others have pointed out Client is unnecessary and the same as Server.

template.ImageLabel.TextLabel.Text = "Host: " .. Server.Name

The image provided seems a lot better than the first one. “This does not work” but what end result do you want?

im so dumb, i forgot to make the gui visible.