Before I start..
while wait(0.5) do
local Playing = game.ServerStorage:WaitForChild("GameState"):WaitForChild("Playing")
if Playing.Value == true then
for i, v in pairs(game.Players:GetPlayers()) do
local WeaponToFind = v.Stats.LoadoutGun.Value
if v.Backpack:FindFirstChild(WeaponToFind) == nil or v.Character:FindFirstChild(WeaponToFind) == nil then
local WeaponToGive = game.ReplicatedStorage.Weapons:FindFirstChild(WeaponToFind):Clone()
WeaponToGive.Parent = v.Backpack
elseif v.Backpack:FindFirstChild(WeaponToFind) ~= nil or v.Character:FindFirstChild(WeaponToFind) ~= nil then
end
end
end
end
This is in a ServerScript in ServerScriptService game.ServerScriptService.OnStart.WeaponsGive
As the title suggests, I'm having problems with the server finding if a player has a tool in either their backpack or their character. It's supposed to do nothing if it finds the tool, as the loop is constantly repeating, and it's supposed to give the tool if it finds nothing.
However, it always seems to be nil, since the code is giving the tool over and over and over again. Not sure what I'm doing wrong, so I figured maybe I needed a different set of eyes.
Thanks for all and any help!

2 comments
It's a logic error.
Sorry, I don't understand what that is exactly.