so i tried this code to give me a weapon on press of the button and it didnt work
local player = game.Players.LocalPlayer -- Refer to the Player
local tool = game.ReplicatedStorage.Sword -- Refer to the Tool
script.Parent.MouseButton1Down:connect(function() -- When it's clicked
if player:FindFirstChild("Backpack") then -- Not sure why I added this
tool:Clone().Parent = player.Backpack -- Clone the tool to their inventory
end -- End the if function
end) -- End the MouseButton1Down function

2 comments
code block
alright, i showed an example