Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why the client passing nil to the server (Remote Event) ?

When printing the copyCard in the Local Script there are an output (Feral Imp) but when the copy card is passed to the server its become nil why ? and how to fix ?

local script

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local transfateToDeckEvent = ReplicatedStorage:WaitForChild("TransfateToDeckEvent")
card = script.Parent.Parent

local copyCard = card:Clone()
print("client output : ",copyCard)
transfateToDeckEvent:FireServer(copyCard)

script

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local transfateToDeckEvent = Instance.new("RemoteEvent", ReplicatedStorage)
transfateToDeckEvent.Name = "TransfateToDeckEvent"

local function transfareToDeck(player, Args)
	print("server output : ",copyCard)
end

transfateToDeckEvent.OnServerEvent:Connect(transfareToDeck)

This is the output:

client output : Feral Imp server output : nil

1 answer

You're creating a clone in the localscript, anything done in a localscript will only happen for the client, the clone doesn't exist on the server, when you then pass that as an argument it will look for it on the server but it will not exist.

2 comments

0

I would also like to add that the the wrong name (server-side) is being used to refer to the card.

0

Thanks

This discussion is preserved as it was. New answers, comments, and votes are closed.