How to send a Clone together with the FireServer?

Well, I have a problem with something from the FireServer and it is that I want to send a clone but when I send it I don’t know how to receive the clone with the OnServerEvent.

This is the Fire script:

local Button = script.Parent
local EnabledValue = script.Parent:FindFirstChild("Enabled")
local ChoosePlayerList = script.Parent.Parent.Parent.Parent.Parent:FindFirstChild("ChosenPlayers"):FindFirstChild("Players"):FindFirstChild("ScrollingFrame")
local AllPlayersList = script.Parent.Parent.Parent:FindFirstChild("ScrollingFrame")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Event =ReplicatedStorage:FindFirstChild("PlayerListSelectionDrop")
local IDName = script.Parent:FindFirstChild("IdName")
local Player = game:GetService("Players").LocalPlayer

script.Parent.MouseButton1Click:Connect(function()
Event:FireServer(Player, Button:Clone())
end)

This is the OnServerEvent:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Event = ReplicatedStorage:FindFirstChild("PlayerListSelectionDrop")
local Players = game:GetService("Players")

Event.OnServerEvent:Connect(function(Player, Clone)
local Gui = Players:FindFirstChild(Player.Name).PlayerGui:FindFirstChild("Configuracion")
local PlayerList = Gui:FindFirstChild("Playerlist")
local ChoosenList = PlayerList:FindFirstChild("ChosenPlayers"):FindFirstChild("Players"):FindFirstChild("ScrollingFrame")
Clone.Parent = ChoosenList
end)
1 Like

When Firing an event from the client the player argument is already given, so in this case you are sending 3 objects being the first the player, then the player again, and finally the clone, what you should do is remove the player argument from the :fireserver() and that should work

1 Like

Well, now I don’t just get an error from that … ServerScriptService.Script:11: attempt to index nil with 'Parent'

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Event = ReplicatedStorage:FindFirstChild("PlayerListSelectionDrop")
local Players = game:GetService("Players")

Event.OnServerEvent:Connect(function(Player, Clone)
print(Player)
local Gui = Players:FindFirstChild(Player.Name).PlayerGui:FindFirstChild("Configuracion")
local PlayerList = Gui:FindFirstChild("Playerlist")
local ChoosenList = PlayerList:FindFirstChild("ChosenPlayers"):FindFirstChild("Players"):FindFirstChild("ScrollingFrame")
local Button = Clone
Button.Parent = ChoosenList
end)
1 Like

You’re cloning it on client it doesn’t exist on server it will always return nil, you can’t send something created on client to server.

2 Likes