:FindFirstChild checking if tool is still in backpack not working

Everything works, script is in a serverscript, connected to a localscript.

Only the leaderstat value won’t change.

image

game.ReplicatedStorage.narko.sprzedawanie.OnServerEvent:Connect(function(player)
	local gracz = game.Players:FindFirstChild(player.Name)
	local leaderstats = gracz:FindFirstChild("leaderstats").Dolars
	
	local sigma = player.Backpack:FindFirstChild("ziolo")
		
		if sigma then
			sigma:Destroy()
		end
		
		if sigma == false then	
			leaderstats.Value = leaderstats.Value + 300
	end
end)

If the tool is not in the backpack, sigma will return nil, so the condition: sigma == false could never be true

if sigma then
	sigma:Destroy()
else
	leaderstats.Value += 300
end

Try that and see if it works

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.