i press more than once and it gives me the weapons and if i press it gives me the weapons (again) so on, how do i fix this? there is two, the one for the button is this
local player = game.Players.LocalPlayer script.Parent.MouseButton1Down:connect( function() game.ReplicatedStorage.RemoteEvent:FireServer(player) end )
the script in the server replicated storage is
if game.Players.LocalPlayer.Backpack:FindFirstChild("weaponname") then return end
Check if the weapon was already given. Server script:
local Weapon = -- Tool game.ReplicatedStorage.RemoteEvent:Connect(function(Player) if Player.Backpack:FindFirstChild(Weapon.Name) ~= nil then return else if Player.Character ~= nil then if Player.Character:FindFirstChild(Weapon.Name) ~= nil then return end end Weapon:Clone().Parent = player.Backpack end