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

Remote Event not passing a parameter?

I am having issues passing parameters to a remote event...

Here is the localscript:

player = script.Parent.Parent.Parent
backpack = player.Backpack

for i, v in pairs(script.Parent.Main:GetChildren()) do
	v.MouseButton1Up:connect(function () game.Workspace.ClonesRE:FireServer(v) end)
-- 'v' represents the textboxes the player is given to click on
end

Here is the Server script the event calls:

script.Parent.ClonesRE.OnServerEvent:connect(function (player, class)
-- 'v' is passed here as 'class'.  Although, it comes up as nil once it reaches here
	local backpack = player.Backpack
	--Clear backpack
	for i, v in pairs(backpack:GetChildren()) do v:remove() end
	--Enter new tools
	for i, v in pairs(class:GetChildren()) do
		if v:IsA("Tool") then
			v:Clone().Parent = backpack
		elseif v:IsA("HopperBin") then
			v:Clone().Parent = backpack
		end
	end
end)

Let me know if you need more details.

Thanks

1 answer

✓ Accepted answer

Server scripts cannot access PlayerGui with Filtering Enabled on :(. It won't error but the client doesn't replicate it to the server.

Instead of passing the instance try passing the name of it, or if you need more than just the name pass all the stuff you need from v in a table

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