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

Remote Events not giving items?

Okay so I have an issue that when you click a item it would give you the item. This game is Filtering Enabled. Network script is a regular script and the first block of code is a local script. The problem is that the script isn't working and I don't know what to do.

-- Local Script
local ServerRequest = game:GetService("ReplicatedStorage"):WaitForChild("NetworkFolder"):WaitForChild("ServerRequest")

for i,v in pairs(script.Parent.ClickDetector) do
v.MouseClick:connect(function()
	ServerRequest:FireServer('tool2')
end)
end
-- Part that isn't working
	elseif request == 'tool2' then
		Tools:FindFirstChild("BananaDount"):Clone().Parent = player.Backpack	
--Entire network script (server script)
local NetworkFolder = game:GetService("ReplicatedStorage"):WaitForChild("NetworkFolder")
local Tools = game:GetService("ReplicatedStorage"):WaitForChild("Tools")

NetworkFolder:WaitForChild("ServerRequest").OnServerEvent:connect(function(player, request, data)
	print(player, request, data[1])
	if request == 'tool' then
		Tools:FindFirstChild(data[1]):Clone().Parent = player.Backpack
	elseif request == 'tool2' then
		Tools:FindFirstChild("BananaDount"):Clone().Parent = player.Backpack	
	elseif request == 'respawn' then
		print(player.Name..' respawned '..data[1])
		if game.Players:FindFirstChild(data[1]) then
			game.Players[data[1]]:LoadCharacter()
		end
	elseif request == 'handto' then
		if game.Players:FindFirstChild(data[1]) and game.Workspace:FindFirstChild(player.Name):FindFirstChild(data[2]) then
			local player2 = game.Players:FindFirstChild(data[1])
			local tool = game.Workspace:FindFirstChild(player.Name):FindFirstChild(data[2])
			tool:Clone().Parent = player2.Backpack
			tool:Destroy()
		end
	end
end)

1 answer

When I used this set up the only way I could get it working was by supplying the 3rd argument "data", I simply added a 2 value table to the FireServer('tool2') It became

ServerRequest:FireServer('tool2', {"test","test"})

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