Reducing number of RemoteEvents

How would I use one RemoteEvent to give a player tools that they select from a GUI? This is the current code I have in a server script and was considering making a RemoteEvent for each tool.


game:GetService("ReplicatedStorage"):WaitForChild("CantinaRemoteEvents"):WaitForChild().OnServerEvent:Connect(function(player)
	
	local clone = game:GetService("ReplicatedStorage"):WaitForChild("CantinaItems"):WaitForChild("RoastedWomprat"):Clone()
	clone.Parent = player.Backpack
	
end)```
2 Likes

it is so easy just when you fire the remote event from the client give it the tool name and put all the tools in a folder in the replicated storage and use the :FindFirstChild method to find the tool in the folder

How would I give it the tool name?

1 Like

like this RemoteEvent:FireServer(tool.Name) and from the server RemoteEvent.OnServerEvent:Connect(function(player , Tool)
the tool is the tool name and the player is a value that the remote event will give on it is own
end)

making a remote event for every tool will cause low performance

Thank you for your help, have a great day!

1 Like

do not mention it ! (i wrote this to make the forum accept the message)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.