How to make tool that will give you 2 or more tools

i want to know how to make tool that will give you 2 or more tools (like gift)

The issue in that i don’t know how to script and i am newbie.

( also sorry for the bad grammar )

i tried to look up everywhere and i couldn’t find it

You just simply wanna use the activated function, clone the tools/items and then put them in the player’s backpack:

local ServerStorage = game:GetService("ServerStorage") 

local Player = script:FindFirstAncestorWhichIsA("Player")
local Item1 = ServerStorage.Item1
local Item2 = ServerStorage.Item2
local Gift = script.Parent

Gift.Activated:Connect(function()
	Item1:Clone().Parent = Player.Backpack
	Item2:Clone().Parent = Player.Backpack
	
	Gift:Destroy()
end)
1 Like

To do this, you need to create an RemoteEvent in ReplicatedStorage. After you do that, you’ll need to add a script in ServerScriptService, and a Tools in ReplicatedStorage. It will be like this:


local RemoteEvent = game.ReplicatedStorage.RemoteEvent

RemoteEvent.OnServerEvent:Connect(function(player)
      local Tool = game.ReplicatedStorage.Tool
      if Tool then
          Tool:Clone().Parent = player.Backpack
     end
end)

Now for local script it will be like this:

local Button = script.Parent

Button.MouseButton1Click:Connect(function()
     local ToolEvent = game.ReplicatedStorage.RemoteEvent
     ToolEvent :FireServer()
end)

It would work if it was a button, he wants to have the gift as a tool, not a gui/textbutton

Item1 is not a valid member of ServerStorage “ServerStorage”

You have to have the “Item1” and “Item2” in ServerStorage. The Item1 and Item2 are things you are gonna get when you open the gift.

I did, i even tried to change ServerStorage to ReplicatedStorage and i put there item1 and item2.
And… nothing

Where did you put the script and what type of script is it

1 Like

local type, i just created tool and named it gift, then i put local script and pasted code and then i added item1 and item2 to ServerStorage.

It has to be a server sided script for it to work, since you can only access ServerStorage from the server.

This script solves all problems without needing anything more than two tools named “Tool1” and “Tool2” in ServerStorage:

local Tool = script.Parent
local ServerStorage = game:GetService("ServerStorage")

Tool.Activated:Connect(function()
	local player = game.Players:FindFirstChild(Tool.Parent.Name)
	if player then
		for _, tool in ipairs(ServerStorage:GetChildren()) do
			if tool:IsA("Tool") then
				tool:Clone().Parent = player.Backpack
			end
		end
	end
end)

Put this script inside of the tool that’s supposed to give two more.

And yes you’re right, it must be a server-sided script because it has to be able to access the ServerStorage, a server-sided service

idk but it does nothing, even i change everything