So anyway I made two tool givers GUI, one gives a knife and pistol, the other a AWP and bloxy cola however clicking on one of those two tool giver GUI's will both give It to them, A example, If I clicked the GUI to give me the knife Instead of the pistol, It will give me the knife but also the gun as well, happens vise-versa
server script In ServerScriptService:
local Rep = game:GetService("ReplicatedStorage") local event = Rep.RemoteEvent local descendants = Rep.Weapons:GetDescendants() local function giveTools(player) for index, descendant in pairs(descendants) do if descendant.Name == "Average knife" or descendant.Name == "Pistol" then local weaponsToGive = descendant:Clone() weaponsToGive.Parent = player.Backpack end end end event.OnServerEvent:Connect(giveTools) local function giveTools(player) for index, descendant in pairs(descendants) do if descendant.Name == "AWP" or descendant.Name == "Bloxy Cola" then local weaponsToGive = descendant:Clone() weaponsToGive.Parent = player.Backpack end end end event.OnServerEvent:Connect(giveTools)
If this is all in the same script, that would be because you are connecting the same event to two different functions (that have the same name) without any other parameters.
Try adding an argument to each function (the type of tools to give) and give the functions unique names.
local Rep = game:GetService("ReplicatedStorage") local event = Rep.RemoteEvent local descendants = Rep.Weapons:GetDescendants() local function giveTools(player, toolsType) for index, descendant in pairs(descendants) do if toolsType == "KnifeAndPistol" then if descendant.Name == "Average knife" or descendant.Name == "Pistol" then local weaponsToGive = descendant:Clone() weaponsToGive.Parent = player.Backpack end elseif toolsType == "AWPAndCola" then if descendant.Name == "AWP" or descendant.Name == "Bloxy Cola" then local weaponsToGive = descendant:Clone() weaponsToGive.Parent = player.Backpack end end end end event.OnServerEvent:Connect(giveTools, toolsType)
Then in your local script, you can add the appropriate argument to the event.
For example:
event:FireServer("KnifeAndPistol") -- Will add the knife and pistol event:FireServer("AWPAndCola") -- Will add the AWP and bloxy cola