Sending TextLabel Text to server comes out as the player?

Just to clear the title up a bit, when I’m sending both the player and text from a TextLabel from client to server, they both come out as the player when printing them on the server side? But they are different on client?

I’m fairly new to remote events so sorry if this sounds stupid!
(I also apologize if this sounds confusing)

–Output–
image

–Local Script–

local Player = game.Players.LocalPlayer

script.Parent.MouseButton1Click:Connect(function()
	Player.PlayerGui.Workbench_UI.Input_Bar.Index_Label.Text = script.Parent.TextLabel.Text
	local Text = Player.PlayerGui.Workbench_UI.Input_Bar.Index_Label.Text
	
	print("Local_Item:", Text)
	print("Local_Player:", Player)
	
	game.ReplicatedStorage.Remote_Events.CC342:FireServer(Player, Text)
end)

–Server Script–

local Index = require(script.Parent.Parent.Parent.Index_Background.Index)

game.ReplicatedStorage.Remote_Events.CC342.OnServerEvent:Connect(function(Player, Text)
	local Inv = Player.Backpack
	
	print("Server_Item:", Text)
	print("Server_Player:", Player)
end)

(This might have existed somewhere on the devforum already but I didn’t find anything that could help, so if you find one mind replying with it?)

1 Like

Player is automatically sent through. No need to include it again.

What do you mean by this?

Like I’m formatting the text as if it was a player?

If yeah how would I format it?

Here you send the player through the event, but when a RemoteEvents OnServerEvent is triggered, it automatically has the player as a argument, so there is no need to pass it!

Just replace the quoted code with this:

game.ReplicatedStorage.Remote_Events.CC342:FireServer(Text)
2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.