I want to print a BillboardGui’s name through a RemoteEvent → Server to Client.
However, I am having problems printing a BillboardGui’s name via. a RemoteEvent.
I haven’t found any solutions so far.
-- Server Code
local Players = game:GetService("Players");
local ServerStorage = game:GetService("ServerStorage");
local ReplicatedStorage = game:GetService("ReplicatedStorage");
local ChannelInformation = ServerStorage:WaitForChild("ChannelInformation");
local HideInfo = ReplicatedStorage:WaitForChild("HideInfo");
Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
local Head = Character:WaitForChild("Head", 2);
if Head then
local Humanoid = Character:FindFirstChildOfClass("Humanoid");
if Humanoid then
Humanoid.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None;
local ChannelInfo = ChannelInformation:Clone();
ChannelInfo.Adornee = Head;
ChannelInfo.Parent = Head;
HideInfo:FireClient(Player, ChannelInfo);
end;
end;
end);
end);
-- Client Code
local ReplicatedStorage = game:GetService("ReplicatedStorage");
local HideInfo = ReplicatedStorage:WaitForChild("HideInfo");
HideInfo.OnClientEvent:Connect(function(Player, ChannelInfo)
if ChannelInfo then
print(ChannelInfo.Name);
else
warn("dies");
end;
end);

do not fire client with player, make sure that on client event still has player, but not fire client
Do you mean removing the Player Argument from the Server Script or Client Script?
client script, firing the client already does that, no need for player
That still does not work as the client thinks it does not exist for some reason even though it should exist.
it looks like this now right?
charszss
It does not look like that I need the player argument.
no you don’t, just try it, trust me
remote events already handle that lol
Even not including the player argument in the client code it still does not exist. (My client code is in StarterCharacterScripts)
whar OH
(i just found out its server then client script
)
my bad
The issue here is that you are firing the player’s client from the server with the parameter ChannelInfo, and on the client, you are registering the ChannelInfo parameter as “player.” The client event does not require a player parameter, as a localscript can already access the localplayer (local plr = game:GetService(“Players”).LocalPlayer). This, in turn, leads to the client’s received 2nd parameter reading nil. Remove the Player parameter from the OnClientEvent function and test it out.
shoot, your right
(im not the smartest sometimes)
don’t worry lol, ive had some of those moments before
I already have it removed did nothing.
what if you find the gui?
local ReplicatedStorage = game:GetService("ReplicatedStorage");
local HideInfo = ReplicatedStorage:WaitForChild("HideInfo");
local plr = game.Players.LocalPlayer
local char = plr.Character
HideInfo.OnClientEvent:Connect(function()
local ChannelInfo = char.Head:FindFirstChildOfClass("BillboardGui") -- it can be any ui type
if ChannelInfo then
print(ChannelInfo.Name);
else
warn("dies");
end;
end);
Ah, you also cannot transfer instances across the client-server boundary. You need to transfer the name string via the FireClient event.
This means that you must do event:FireClient(Player,ChannelInfo.Name).
1 Like
-- Server Code
local Players = game:GetService("Players");
local ServerStorage = game:GetService("ServerStorage");
local ReplicatedStorage = game:GetService("ReplicatedStorage");
local ChannelInformation = ServerStorage:WaitForChild("ChannelInformation");
local HideInfo = ReplicatedStorage:WaitForChild("HideInfo");
Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
local Head = Character:WaitForChild("Head", 2);
if Head then
local Humanoid = Character:FindFirstChildOfClass("Humanoid");
if Humanoid then
Humanoid.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None;
local ChannelInfo = ChannelInformation:Clone();
ChannelInfo.Adornee = Head;
ChannelInfo.Parent = Head;
local Name = ChannelInfo.Name
HideInfo:FireClient(Name);
end;
end;
end);
end);
It works! However I have one more question would it be possible to delete the BillboardGUI from the client instead of including the name?
local plr = game.Players.LocalPlayer
local char = plr.Character
local ChannelInfo = char.Head:WaitForChild(ChannelInfo.Name)
--you can :destroy() from there
i think, if this is what you want, i was kinda confused!