Hello.
I am currently attempting to make a simple system that fires a RemoteEvent from the Server to the Client by sending a TextLabel's text and the Player who clicked with the ClickDetector to a UI in the PlayerGui. This however, is always erroring, and it's because when the LocalScript in the UI recieves the remote, the parameter named NoteText1 being the TextLabel's text being fired from the Server in the first place, returns nil when trying to print it on the Client. I have also done some more experimenting and have also found that at times instead of printing out the Player who clicked the ClickDetector, it prints out the NoteText1 instead of the Player.
Here are the scripts: ServerScript inside a ClickDetector
local ClickDetector = script.Parent
local Note = ClickDetector.Parent
local TextUI = Note.SurfaceGui
local NoteText1 = TextUI.NoteText.Text
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Remotes = ReplicatedStorage.Remotes
local function ViewNote(Player)
Remotes.ViewNote:FireClient(Player, NoteText1)
print(NoteText1) -- Note Text
end
ClickDetector.MouseClick:Connect(ViewNote)
LocalScript inside a UI in PlayerGui
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Remotes = ReplicatedStorage.Remotes
local MainFrame = script.Parent
local NoteText = MainFrame.NoteText
local PlayerName = MainFrame.PlayerName
local function ViewNote(Player, NoteText1)
if not (MainFrame.Visible) then
print(NoteText1) -- nil
MainFrame.Visible = true
NoteText.Text = NoteText1
PlayerName.Text = Player
else
print("Frame is already visible.")
end
end
Remotes.ViewNote.OnClientEvent:Connect(ViewNote)
If I could get some help with this, it would be great.
Thanks!

1 comment
.OnClientEvent does not return the player who the event was fired to because you know that it's the LocalPlayer, in your LocalScript Player variable refers to the NoteText1.